instance method
read_counter
Ruby on Rails 8.1.2
Since v8.1.2Signature
read_counter(name, **options)
Reads a counter that was set by #increment / #decrement.
cache.write_counter("foo", 1) cache.read_counter("foo") # => 1 cache.increment("foo") cache.read_counter("foo") # => 2
Options are passed to the underlying cache implementation.
Parameters
-
namereq -
optionskeyrest
Source
# File activesupport/lib/active_support/cache.rb, line 762
def read_counter(name, **options)
options = merged_options(options).merge(raw: true)
read(name, **options)&.to_i
end
Defined in activesupport/lib/active_support/cache.rb line 762
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Store