Module: Garner::Cache::Binding

Included in:
Mixins::ActiveRecord::Base, Mixins::Mongoid::Document, Mixins::Mongoid::Identity
Defined in:
lib/garner/cache/binding.rb

Instance Method Summary collapse

Instance Method Details

#garner_cache_keyString

Apply the cache key strategy to this binding.

Returns:

  • (String)

    A cache key string.



21
22
23
# File 'lib/garner/cache/binding.rb', line 21

def garner_cache_key
  key_strategy.apply(self)
end

#invalidate_garner_cachesBoolean

Apply the invalidation strategy to this binding.

Returns:

  • (Boolean)

    Returns true on success.



35
36
37
38
# File 'lib/garner/cache/binding.rb', line 35

def invalidate_garner_caches
  _invalidate
  true
end

#invalidation_strategyObject

Override this method to use a custom invalidation strategy.

Returns:

  • (Object)

    The strategy to be used for instances of this class.



28
29
30
# File 'lib/garner/cache/binding.rb', line 28

def invalidation_strategy
  Garner.config.binding_invalidation_strategy
end

#key_strategyObject

Override this method to use a custom key strategy.

Returns:

  • (Object)

    The strategy to be used for instances of this class.



14
15
16
# File 'lib/garner/cache/binding.rb', line 14

def key_strategy
  Garner.config.binding_key_strategy
end