Module: SimpleCache
- Defined in:
- lib/simple_cache.rb,
lib/simple_cache.rb
Defined Under Namespace
Modules: Interface, Marshal, SimplyCached
Classes: RedisStore, SqliteDatabase, SqliteStore
Class Method Summary
collapse
Class Method Details
.create_store(url) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/simple_cache.rb', line 12
def self.create_store(url)
expect! url => [ String, Redis, Redis::Namespace ]
case url
when Redis, Redis::Namespace then
return SimpleCache::RedisStore.new(url)
when String
uri = URI.parse(url)
case uri.scheme
when "redis" then
return SimpleCache::RedisStore.new(url)
when nil, "sqlite" then
return SimpleCache::SqliteStore.new(uri.path)
else raise uri.scheme.inspect
end
end
end
|
.new(url) ⇒ Object
30
31
32
|
# File 'lib/simple_cache.rb', line 30
def self.new(url)
create_store(url).extend SimpleCache::Interface
end
|