Sha256: 9f5a959268eb2708fc9f4ef25623f781e21029c207bb0a8999eea58e9068bc31
Contents?: true
Size: 564 Bytes
Versions: 1
Compression:
Stored size: 564 Bytes
Contents
module RestrictCache class CacheCollection class ActiveRecordCache < InnerCache def add(content) tbl_name, index = table_name_of(content), index_of(content) @caches[tbl_name] ||= {} @caches[tbl_name][index] = content end def contents(_table_name) @caches[_table_name.to_sym] end private def table_name_of(content) content.class.table_name.to_sym end def index_of(content) content.public_send content.class.primary_key end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restrict_cache-0.1.2 | lib/restrict_cache/cache_collection/active_record_cache.rb |