Class: Rack::Cache::Storage
- Inherits:
-
Object
- Object
- Rack::Cache::Storage
- Defined in:
- lib/rack/cache/storage.rb
Overview
Maintains a collection of MetaStore and EntityStore instances keyed by URI. A single instance of this class can be used across a single process to ensure that only a single instance of a backing store is created per unique storage URI.
Constant Summary collapse
- @@singleton_instance =
new
Class Method Summary collapse
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ Storage
constructor
A new instance of Storage.
- #resolve_entitystore_uri(uri, options = {}) ⇒ Object
- #resolve_metastore_uri(uri, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Storage
Returns a new instance of Storage.
12 13 14 15 |
# File 'lib/rack/cache/storage.rb', line 12 def initialize @metastores = {} @entitystores = {} end |
Class Method Details
.instance ⇒ Object
60 61 62 |
# File 'lib/rack/cache/storage.rb', line 60 def self.instance @@singleton_instance end |
Instance Method Details
#clear ⇒ Object
25 26 27 28 29 |
# File 'lib/rack/cache/storage.rb', line 25 def clear @metastores.clear @entitystores.clear nil end |
#resolve_entitystore_uri(uri, options = {}) ⇒ Object
21 22 23 |
# File 'lib/rack/cache/storage.rb', line 21 def resolve_entitystore_uri(uri, = {}) @entitystores[uri.to_s] ||= create_store(EntityStore, uri, ) end |
#resolve_metastore_uri(uri, options = {}) ⇒ Object
17 18 19 |
# File 'lib/rack/cache/storage.rb', line 17 def (uri, = {}) @metastores[uri.to_s] ||= create_store(MetaStore, uri, ) end |