Class: ActiveSupport::Cache::CouchbaseStore::LastMutation
- Inherits:
-
Object
- Object
- ActiveSupport::Cache::CouchbaseStore::LastMutation
- Defined in:
- lib/active_support/cache/couchbase_store.rb,
/home/runner/work/couchbase-ruby-client/couchbase-ruby-client/lib/active_support/cache/couchbase_store.rb
Overview
Default mutation_tracking: the token of the last write.
Instance Method Summary collapse
-
#initialize ⇒ LastMutation
constructor
A new instance of LastMutation.
- #mutation_state ⇒ Object
- #record(*tokens) ⇒ Object
Constructor Details
#initialize ⇒ LastMutation
Returns a new instance of LastMutation.
55 56 57 |
# File 'lib/active_support/cache/couchbase_store.rb', line 55 def initialize @token = nil end |
Instance Method Details
#mutation_state ⇒ Object
64 65 66 67 |
# File 'lib/active_support/cache/couchbase_store.rb', line 64 def mutation_state token = @token token && ::Couchbase::MutationState.new(token) end |
#record(*tokens) ⇒ Object
59 60 61 62 |
# File 'lib/active_support/cache/couchbase_store.rb', line 59 def record(*tokens) latest = tokens.compact.max_by(&:sequence_number) @token = latest if latest end |