module Garner::Cache::Binding

Public Instance Methods

garner_cache_key() click to toggle source

Apply the cache key strategy to this binding.

@return [String] A cache key string.

# File lib/garner/cache/binding.rb, line 21
def garner_cache_key
  key_strategy.apply(self)
end
invalidate_garner_caches() click to toggle source

Apply the invalidation strategy to this binding.

@return [Boolean] Returns true on success.

# File lib/garner/cache/binding.rb, line 35
def invalidate_garner_caches
  _invalidate
  true
end
invalidation_strategy() click to toggle source

Override this method to use a custom invalidation strategy.

@return [Object] The strategy to be used for instances of this class.

# File lib/garner/cache/binding.rb, line 28
def invalidation_strategy
  Garner.config.binding_invalidation_strategy
end
key_strategy() click to toggle source

Override this method to use a custom key strategy.

@return [Object] The strategy to be used for instances of this class.

# File lib/garner/cache/binding.rb, line 14
def key_strategy
  Garner.config.binding_key_strategy
end

Protected Instance Methods

_garner_after_create() click to toggle source
# File lib/garner/cache/binding.rb, line 46
def _garner_after_create
  _invalidate if invalidation_strategy.apply_on_callback?(:create)
end
_garner_after_destroy() click to toggle source
# File lib/garner/cache/binding.rb, line 54
def _garner_after_destroy
  _invalidate if invalidation_strategy.apply_on_callback?(:destroy)
end
_garner_after_update() click to toggle source
# File lib/garner/cache/binding.rb, line 50
def _garner_after_update
  _invalidate if invalidation_strategy.apply_on_callback?(:update)
end
_invalidate() click to toggle source
# File lib/garner/cache/binding.rb, line 42
def _invalidate
  invalidation_strategy.apply(self)
end