Sha256: ba315703a190eae268a2ec488e5bf2250b3b3d48978b495a88ec72b465fd6629

Contents?: true

Size: 1.09 KB

Versions: 28

Compression:

Stored size: 1.09 KB

Contents

module Hobo
  module Controller
    module Cache
      def expire_swept_caches_for(obj, attr=nil)
        typed_id = if attr.nil?
                     if obj.respond_to?(:typed_id)
                       obj.typed_id
                     else
                       obj.to_s
                     end
                   else
                     "#{obj.typed_id}:#{attr}"
                   end
        sweep_key = ActiveSupport::Cache.expand_cache_key(typed_id, :sweep_key)
        if Hobo.stable_cache.respond_to?(:read_matched)
          Hobo.stable_cache.read_matched(/#{sweep_key}/).each do |k,v|
            key=k[sweep_key.length+1..-1]
            Rails.logger.debug "CACHE DELETING #{key}"
            Rails.cache.delete(key)
            Hobo.stable_cache.delete(k)
          end
        else
          keys = Hobo.stable_cache.read(sweep_key)
          return if keys.nil? || keys.empty?
          keys.each do |key|
            Rails.logger.debug "CACHE DELETING #{key}"
            Rails.cache.delete(key)
          end
          Hobo.stable_cache.delete(sweep_key)
        end
      end

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
hobo-2.2.6 lib/hobo/controller/cache.rb
hobo-2.2.5 lib/hobo/controller/cache.rb
hobo-2.2.4 lib/hobo/controller/cache.rb
hobo-2.2.3 lib/hobo/controller/cache.rb
hobo-2.2.2 lib/hobo/controller/cache.rb
hobo-2.2.1 lib/hobo/controller/cache.rb
hobo-2.2.0 lib/hobo/controller/cache.rb
hobo-2.1.2 lib/hobo/controller/cache.rb
hobo-2.1.1 lib/hobo/controller/cache.rb
hobo-2.1.0 lib/hobo/controller/cache.rb
hobo-2.1.0.pre4 lib/hobo/controller/cache.rb
hobo-2.1.0.pre3 lib/hobo/controller/cache.rb
hobo-2.1.0.pre2 lib/hobo/controller/cache.rb
hobo-2.1.0.pre1 lib/hobo/controller/cache.rb
hobo-2.0.1 lib/hobo/controller/cache.rb
hobo-2.0.0 lib/hobo/controller/cache.rb
hobo-2.0.0.pre10 lib/hobo/controller/cache.rb
hobo-2.0.0.pre9 lib/hobo/controller/cache.rb
hobo-2.0.0.pre8 lib/hobo/controller/cache.rb
hobo-2.0.0.pre7 lib/hobo/controller/cache.rb