Sha256: 4d299bfa7219bedef209000b0efdb5868b3a55069796e7e75491123af7ac3c3e
Contents?: true
Size: 811 Bytes
Versions: 2
Compression:
Stored size: 811 Bytes
Contents
module InfoparkComponentCache # @author Tomasz Przedmojski <tomasz.przedmojski@infopark.de> # # Cache entity (component) consists of an obj, a name # and some parameters (hash). It should be used to point # to some data stored in a particular context class Component attr_reader :obj, :component, :params def initialize(obj, component, params={}) @obj, @component, @params = obj, component, params end def name self.component end def cache_key(meta_prefix=nil) if meta_prefix meta_prefix + "_" + KeyGenerator.generate_key(identity_hash) else KeyGenerator.generate_key(identity_hash) end end def identity_hash @params.merge({:obj_name=>@obj.name, :obj_id=>@obj.id, :obj_component=>@component}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
infopark_component_cache-3.1.1 | lib/infopark_component_cache/component.rb |
infopark_component_cache-3.1.0 | lib/infopark_component_cache/component.rb |