lookup_store

- 1.0.0
- 1.1.1
- 1.1.6
- 1.2.0
- 1.2.6
- 2.0.0
- 2.0.3
- 2.1.0 (0)
- 2.2.1 (38)
- 2.3.2 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.5 (0)
- 3.0.9 (-2)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.3 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- What's this?
lookup_store(*store_option)
public
Creates a new CacheStore object according to the given options.
If no arguments are passed to this method, then a new ActiveSupport::Cache::MemoryStore object will be returned.
If you pass a Symbol as the first argument, then a corresponding cache store class under the ActiveSupport::Cache namespace will be created. For example:
ActiveSupport::Cache.lookup_store(:memory_store) # => returns a new ActiveSupport::Cache::MemoryStore object ActiveSupport::Cache.lookup_store(:mem_cache_store) # => returns a new ActiveSupport::Cache::MemCacheStore object
Any additional arguments will be passed to the corresponding cache store class’s constructor:
ActiveSupport::Cache.lookup_store(:file_store, "/tmp/cache") # => same as: ActiveSupport::Cache::FileStore.new("/tmp/cache")
If the first argument is not a Symbol, then it will simply be returned:
ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new) # => returns MyOwnCacheStore.new

Creating additional cache stores
This method can be used to create additional cache stores for your application:
# creates a new Memory Store mem_store = ActiveSupport::Cache.lookup_store # creates a new MemCache Store mem_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, 'localhost:11212', :namespace => 'other_stuff'
The method takes the same arguments as the cache_store config. For more information about that go to ActionController::Caching.