Module: Elephas::Providers::Base
- Extended by:
- ActiveSupport::Concern
- Included in:
- Hash, RubyOnRails
- Defined in:
- lib/elephas/provider.rb
Overview
The base provider, with all methods a valid provider should override.
Instance Method Summary (collapse)
-
- (TrueClass|FalseClass) delete(key)
Deletes a value from the cache.
-
- (TrueClass|FalseClass) exists?(key)
Checks if a key exists in the cache.
-
- (Object) now
Returns the current time for comparing with entries TTL.
-
- (Entry|NilClass) read(key)
Reads a value from the cache.
-
- (Object) write(key, value, options = {})
Writes a value to the cache.
Instance Method Details
- (TrueClass|FalseClass) delete(key)
Deletes a value from the cache.
38 39 40 |
# File 'lib/elephas/provider.rb', line 38 def delete(key) raise ArgumentError.new("A Elephas::Providers subclass must override this method.") end |
- (TrueClass|FalseClass) exists?(key)
Checks if a key exists in the cache.
46 47 48 |
# File 'lib/elephas/provider.rb', line 46 def exists?(key) raise ArgumentError.new("A Elephas::Providers subclass must override this method.") end |
- (Object) now
Returns the current time for comparing with entries TTL.
53 54 55 |
# File 'lib/elephas/provider.rb', line 53 def now ::Time.now.to_f end |
- (Entry|NilClass) read(key)
Reads a value from the cache.
19 20 21 |
# File 'lib/elephas/provider.rb', line 19 def read(key) raise ArgumentError.new("A Elephas::Providers subclass must override this method.") end |
- (Object) write(key, value, options = {})
Writes a value to the cache.
30 31 32 |
# File 'lib/elephas/provider.rb', line 30 def write(key, value, = {}) raise ArgumentError.new("A Elephas::Providers subclass must override this method.") end |