Sha256: 5ebcf9f45af160e78ccdf14e9e3b3b2ff6528ae901390e769fde558bbab291c1
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
class APICache class AbstractStore def initialize raise "Method not implemented. Called abstract class." end # Set value. Returns true if success. def set(key, value) raise "Method not implemented. Called abstract class." end # Get value. def get(key) raise "Method not implemented. Called abstract class." end # Delete the given key. The return value is not used. def delete(key) raise "Method not implemented. Called abstract class." end # Does a given key exist in the cache? def exists?(key) raise "Method not implemented. Called abstract class." end # created_at returns the time when the key was last set def created_at(key) raise "Method not implemented. Called abstract class." end # expired? returns true if the given timeout has passed since the key was # set. It has nothing to say about the existence or otherwise of said key. def expired?(key, timeout) if (created_at = created_at(key)) Time.now - created_at > timeout else # If the created_at data is missing assume expired true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
api_cache-0.3.0 | lib/api_cache/abstract_store.rb |