Class: Rafflesia::CacheSweepRequest

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

Constant Summary collapse

HASH_ATTRS =
{
  apply: :apply,
  dry_run: :dry_run,
  max_bytes: :max_bytes,
  namespace: :namespace,
  older_than_seconds: :older_than_seconds,
  pinned_paths: :pinned_paths,
  policy: :policy,
  target_dir: :target_dir
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CacheSweepRequest

Returns a new instance of CacheSweepRequest.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 29

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @apply = hash[:apply]
  @dry_run = hash[:dry_run]
  @max_bytes = hash[:max_bytes]
  @namespace = hash[:namespace]
  @older_than_seconds = hash[:older_than_seconds]
  @pinned_paths = (hash[:pinned_paths] || [])
  @policy = hash[:policy] ? Rafflesia::CacheEvictionPolicy.new(hash[:policy]) : nil
  @target_dir = hash[:target_dir]
end

Instance Attribute Details

#applyObject

Returns the value of attribute apply.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def apply
  @apply
end

#dry_runObject

Returns the value of attribute dry_run.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def dry_run
  @dry_run
end

#max_bytesObject

Returns the value of attribute max_bytes.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def max_bytes
  @max_bytes
end

#namespaceObject

Returns the value of attribute namespace.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def namespace
  @namespace
end

#older_than_secondsObject

Returns the value of attribute older_than_seconds.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def older_than_seconds
  @older_than_seconds
end

#pinned_pathsObject

Returns the value of attribute pinned_paths.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def pinned_paths
  @pinned_paths
end

#policyObject

Returns the value of attribute policy.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def policy
  @policy
end

#target_dirObject

Returns the value of attribute target_dir.



19
20
21
# File 'lib/rafflesia/cache/cache_sweep_request.rb', line 19

def target_dir
  @target_dir
end