Sha256: 3f840aee91d9d4374cf5c17e1ed2f1d3d27872823a1586104274cbbef82bd524

Contents?: true

Size: 409 Bytes

Versions: 2

Compression:

Stored size: 409 Bytes

Contents

module RestrictCache
  class Cacheable
    class ActiveRecordCache < Base
      def add(content)
        @caches[table_name(content)] ||= {}
        @caches[table_name(content)][content.id] = content
      end

      def contents(_table_name)
        @caches[_table_name.to_sym]
      end

      private
        def table_name(content)
          content.class.table_name.to_sym
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restrict_cache-0.1.1 lib/restrict_cache/cacheable/active_record_cache.rb
restrict_cache-0.1.0 lib/restrict_cache/cacheable/active_record_cache.rb