Class: Rafflesia::CacheEvictionPolicy

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/cache/cache_eviction_policy.rb

Constant Summary collapse

HASH_ATTRS =
{
  max_age_seconds: :max_age_seconds,
  max_bytes: :max_bytes,
  namespace: :namespace,
  older_than_seconds: :older_than_seconds,
  pinned_paths: :pinned_paths,
  pinned_shards: :pinned_shards
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CacheEvictionPolicy

Returns a new instance of CacheEvictionPolicy.



25
26
27
28
29
30
31
32
33
34
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 25

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @max_age_seconds = hash[:max_age_seconds]
  @max_bytes = hash[:max_bytes]
  @namespace = hash[:namespace]
  @older_than_seconds = hash[:older_than_seconds]
  @pinned_paths = (hash[:pinned_paths] || [])
  @pinned_shards = (hash[:pinned_shards] || [])
end

Instance Attribute Details

#max_age_secondsObject

Returns the value of attribute max_age_seconds.



17
18
19
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 17

def max_age_seconds
  @max_age_seconds
end

#max_bytesObject

Returns the value of attribute max_bytes.



17
18
19
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 17

def max_bytes
  @max_bytes
end

#namespaceObject

Returns the value of attribute namespace.



17
18
19
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 17

def namespace
  @namespace
end

#older_than_secondsObject

Returns the value of attribute older_than_seconds.



17
18
19
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 17

def older_than_seconds
  @older_than_seconds
end

#pinned_pathsObject

Returns the value of attribute pinned_paths.



17
18
19
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 17

def pinned_paths
  @pinned_paths
end

#pinned_shardsObject

Returns the value of attribute pinned_shards.



17
18
19
# File 'lib/rafflesia/cache/cache_eviction_policy.rb', line 17

def pinned_shards
  @pinned_shards
end