Class: ConvenientService::Support::Cache::Entities::Caches::Base

Inherits:
Object
  • Object
show all
Includes:
AbstractMethod
Defined in:
lib/convenient_service/support/cache/entities/caches/base.rb

Direct Known Subclasses

Array, Hash

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AbstractMethod

abstract_method

Constructor Details

#initialize(store: nil, default: nil, parent: nil, key: nil) ⇒ void

Parameters:



110
111
112
113
114
115
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 110

def initialize(store: nil, default: nil, parent: nil, key: nil)
  @store = store
  @default = default
  @parent = parent
  @key = key
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



35
36
37
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 35

def default
  @default
end

#keyObject (readonly)

Note:

key is only present when cache is scoped.



51
52
53
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 51

def key
  @key
end

#parentObject (readonly)

Note:

parent is only present when cache is scoped.



43
44
45
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 43

def parent
  @parent
end

#storeObject (readonly)

Returns the value of attribute store.



29
30
31
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 29

def store
  @store
end

Class Method Details

.keygenConvenientService::Support::Cache::Entities::Key



20
21
22
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 20

def keygen(...)
  Entities::Key.new(...)
end

Instance Method Details

#==(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


168
169
170
171
172
173
174
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 168

def ==(other)
  return unless other.instance_of?(self.class)

  return false if store != other.store

  true
end

#[]Object

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



130
131
132
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 130

def [](...)
  read(...)
end

#[]=Object

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



150
151
152
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 150

def []=(...)
  write(...)
end

#clearConvenientService::Support::Cache::Enitities::Caches::Base

Returns:

  • (ConvenientService::Support::Cache::Enitities::Caches::Base)


86
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 86

abstract_method :clear

#default=Object (readonly)

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



101
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 101

abstract_method :default=

#deleteObject?

Returns Can be any type.

Returns:

  • (Object, nil)

    Can be any type.



81
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 81

abstract_method :delete

#empty?Boolean

Returns:

  • (Boolean)


56
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 56

abstract_method :empty?

#exist?Boolean

Returns:

  • (Boolean)


61
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 61

abstract_method :exist?

#fetchObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



76
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 76

abstract_method :fetch

#getObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



140
141
142
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 140

def get(...)
  read(...)
end

#keygenConvenientService::Support::Cache::Entities::Key



120
121
122
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 120

def keygen(...)
  self.class.keygen(...)
end

#readObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



66
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 66

abstract_method :read

#scopeConvenientService::Support::Cache::Enitities::Caches::Base

Returns:

  • (ConvenientService::Support::Cache::Enitities::Caches::Base)


91
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 91

abstract_method :scope

#scope!ConvenientService::Support::Cache::Enitities::Caches::Base

Returns:

  • (ConvenientService::Support::Cache::Enitities::Caches::Base)


96
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 96

abstract_method :scope!

#setObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



160
161
162
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 160

def set(...)
  write(...)
end

#writeObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



71
# File 'lib/convenient_service/support/cache/entities/caches/base.rb', line 71

abstract_method :write