simple_cache_rs 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,16 @@
1
1
  require "redis"
2
+ require "redis/namespace"
2
3
 
3
4
  class SimpleCache::RedisStore
4
5
  Marshal = ::SimpleCache::Marshal
5
6
 
6
- def initialize(url)
7
- @redis = Redis.connect(:url => url)
7
+ def initialize(redis)
8
+ case redis
9
+ when Redis, Redis::Namespace
10
+ @redis = redis
11
+ else
12
+ @redis = Redis.connect(:url => redis)
13
+ end
8
14
  end
9
15
 
10
16
  def clear
data/lib/simple_cache.rb CHANGED
@@ -5,14 +5,19 @@ end
5
5
 
6
6
  require_relative "simple_cache/marshal"
7
7
  require_relative "simple_cache/sqlite_store"
8
+ require_relative "simple_cache/redis_store"
8
9
 
9
10
  module SimpleCache
10
11
  def self.new(url)
12
+ case url
13
+ when Redis, Redis::Namespace then
14
+ return SimpleCache::RedisStore.new(url)
15
+ end
16
+
11
17
  uri = URI.parse(url)
12
18
 
13
19
  cache = case uri.scheme
14
20
  when "redis" then
15
- require_relative "simple_cache/redis_store"
16
21
  SimpleCache::RedisStore.new(url)
17
22
  when nil, "sqlite" then
18
23
  SimpleCache::SqliteStore.new(uri.path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_cache_rs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,114 +9,26 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: sqlite3
16
- requirement: &70171064055940 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *70171064055940
25
- - !ruby/object:Gem::Dependency
26
- name: bundler
27
- requirement: &70171064054980 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *70171064054980
36
- - !ruby/object:Gem::Dependency
37
- name: jeweler
38
- requirement: &70171064052800 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :development
45
- prerelease: false
46
- version_requirements: *70171064052800
47
- - !ruby/object:Gem::Dependency
48
- name: simplecov
49
- requirement: &70171064051480 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: *70171064051480
58
- - !ruby/object:Gem::Dependency
59
- name: ruby-debug19
60
- requirement: &70171064050440 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *70171064050440
69
- - !ruby/object:Gem::Dependency
70
- name: timecop
71
- requirement: &70171064035160 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *70171064035160
80
- - !ruby/object:Gem::Dependency
81
- name: redis
82
- requirement: &70171064032640 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
88
- type: :development
89
- prerelease: false
90
- version_requirements: *70171064032640
91
- description: A sensibly fast, yet simplistic file based cache.
92
- email: eno@open-lab.org
12
+ date: 2012-09-10 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A sensibly fast, yet simplistic sqlite- or redis-based cache.
15
+ email: eno@radiospiel.org
93
16
  executables: []
94
17
  extensions: []
95
- extra_rdoc_files:
96
- - LICENSE.txt
97
- - README.rdoc
18
+ extra_rdoc_files: []
98
19
  files:
99
- - .document
100
- - Gemfile
101
- - Gemfile.lock
102
- - LICENSE.txt
103
- - README.rdoc
104
- - Rakefile
105
- - VERSION
106
- - lib/simple_cache.rb
107
20
  - lib/simple_cache/marshal.rb
108
21
  - lib/simple_cache/redis_store.rb
109
22
  - lib/simple_cache/sqlite_store.rb
110
- - simple_cache.gemspec
111
- - simple_cache_rs.gemspec
23
+ - lib/simple_cache.rb
24
+ - README.rdoc
112
25
  - test/memoize_test.rb
113
26
  - test/redis_store_test.rb
114
27
  - test/simple_cache_test.rb
115
28
  - test/sqlite_store_test.rb
116
29
  - test/test_helper.rb
117
30
  homepage: http://github.com/radiospiel/simple_cache
118
- licenses:
119
- - MIT
31
+ licenses: []
120
32
  post_install_message:
121
33
  rdoc_options: []
122
34
  require_paths:
@@ -129,7 +41,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
41
  version: '0'
130
42
  segments:
131
43
  - 0
132
- hash: -1481443802176194731
44
+ hash: -1566878442265623169
133
45
  required_rubygems_version: !ruby/object:Gem::Requirement
134
46
  none: false
135
47
  requirements:
@@ -138,8 +50,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
50
  version: '0'
139
51
  requirements: []
140
52
  rubyforge_project:
141
- rubygems_version: 1.8.10
53
+ rubygems_version: 1.8.24
142
54
  signing_key:
143
55
  specification_version: 3
144
- summary: You need a cache? Just throw me in.
56
+ summary: A sensibly fast, yet simplistic sqlite- or redis-based cache.
145
57
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "sqlite3"
3
-
4
- # Add dependencies to develop your gem here.
5
- # Include everything needed to run rake, tests, features, etc.
6
- group :development do
7
- gem "bundler"
8
- gem "jeweler"
9
- gem 'simplecov', :require => false
10
- gem "ruby-debug19"
11
- gem "timecop"
12
- gem "redis"
13
- end
14
-
data/Gemfile.lock DELETED
@@ -1,47 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- archive-tar-minitar (0.5.2)
5
- columnize (0.3.6)
6
- git (1.2.5)
7
- jeweler (1.8.3)
8
- bundler (~> 1.0)
9
- git (>= 1.2.5)
10
- rake
11
- rdoc
12
- json (1.6.6)
13
- linecache19 (0.5.12)
14
- ruby_core_source (>= 0.1.4)
15
- multi_json (1.2.0)
16
- rake (0.9.2.2)
17
- rdoc (3.12)
18
- json (~> 1.4)
19
- redis (2.2.2)
20
- ruby-debug-base19 (0.11.25)
21
- columnize (>= 0.3.1)
22
- linecache19 (>= 0.5.11)
23
- ruby_core_source (>= 0.1.4)
24
- ruby-debug19 (0.11.6)
25
- columnize (>= 0.3.1)
26
- linecache19 (>= 0.5.11)
27
- ruby-debug-base19 (>= 0.11.19)
28
- ruby_core_source (0.1.5)
29
- archive-tar-minitar (>= 0.5.2)
30
- simplecov (0.6.1)
31
- multi_json (~> 1.0)
32
- simplecov-html (~> 0.5.3)
33
- simplecov-html (0.5.3)
34
- sqlite3 (1.3.5)
35
- timecop (0.3.5)
36
-
37
- PLATFORMS
38
- ruby
39
-
40
- DEPENDENCIES
41
- bundler
42
- jeweler
43
- redis
44
- ruby-debug19
45
- simplecov
46
- sqlite3
47
- timecop
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2012 radiospiel
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "simple_cache_rs"
18
- gem.homepage = "http://github.com/radiospiel/simple_cache"
19
- gem.license = "MIT"
20
- gem.summary = %Q{You need a cache? Just throw me in.}
21
- gem.description = %Q{A sensibly fast, yet simplistic file based cache.}
22
- gem.email = "eno@open-lab.org"
23
- gem.authors = ["radiospiel"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rake/testtask'
29
- Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/*_test.rb'
32
- test.verbose = true
33
- end
34
-
35
- task :default => :test
36
-
37
- require 'rdoc/task'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "micro_sql #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.10.0
data/simple_cache.gemspec DELETED
@@ -1,72 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "simple_cache"
8
- s.version = "0.9.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["radiospiel"]
12
- s.date = "2012-04-08"
13
- s.description = "A sensibly fast, yet simplistic file based cache."
14
- s.email = "eno@open-lab.org"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/simple_cache.rb",
28
- "lib/simple_cache/marshal.rb",
29
- "lib/simple_cache/redis_store.rb",
30
- "lib/simple_cache/sqlite_store.rb",
31
- "simple_cache.gemspec",
32
- "test/redis_store_test.rb",
33
- "test/sqlite_store_test.rb",
34
- "test/test_helper.rb"
35
- ]
36
- s.homepage = "http://github.com/radiospiel/simple_cache"
37
- s.licenses = ["MIT"]
38
- s.require_paths = ["lib"]
39
- s.rubygems_version = "1.8.17"
40
- s.summary = "You need a cache? Just throw me in."
41
-
42
- if s.respond_to? :specification_version then
43
- s.specification_version = 3
44
-
45
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
- s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
47
- s.add_development_dependency(%q<bundler>, [">= 0"])
48
- s.add_development_dependency(%q<jeweler>, [">= 0"])
49
- s.add_development_dependency(%q<simplecov>, [">= 0"])
50
- s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
51
- s.add_development_dependency(%q<timecop>, [">= 0"])
52
- s.add_development_dependency(%q<redis>, [">= 0"])
53
- else
54
- s.add_dependency(%q<sqlite3>, [">= 0"])
55
- s.add_dependency(%q<bundler>, [">= 0"])
56
- s.add_dependency(%q<jeweler>, [">= 0"])
57
- s.add_dependency(%q<simplecov>, [">= 0"])
58
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
59
- s.add_dependency(%q<timecop>, [">= 0"])
60
- s.add_dependency(%q<redis>, [">= 0"])
61
- end
62
- else
63
- s.add_dependency(%q<sqlite3>, [">= 0"])
64
- s.add_dependency(%q<bundler>, [">= 0"])
65
- s.add_dependency(%q<jeweler>, [">= 0"])
66
- s.add_dependency(%q<simplecov>, [">= 0"])
67
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
68
- s.add_dependency(%q<timecop>, [">= 0"])
69
- s.add_dependency(%q<redis>, [">= 0"])
70
- end
71
- end
72
-
@@ -1,75 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "simple_cache_rs"
8
- s.version = "0.10.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["radiospiel"]
12
- s.date = "2012-05-23"
13
- s.description = "A sensibly fast, yet simplistic file based cache."
14
- s.email = "eno@open-lab.org"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/simple_cache.rb",
28
- "lib/simple_cache/marshal.rb",
29
- "lib/simple_cache/redis_store.rb",
30
- "lib/simple_cache/sqlite_store.rb",
31
- "simple_cache.gemspec",
32
- "simple_cache_rs.gemspec",
33
- "test/memoize_test.rb",
34
- "test/redis_store_test.rb",
35
- "test/simple_cache_test.rb",
36
- "test/sqlite_store_test.rb",
37
- "test/test_helper.rb"
38
- ]
39
- s.homepage = "http://github.com/radiospiel/simple_cache"
40
- s.licenses = ["MIT"]
41
- s.require_paths = ["lib"]
42
- s.rubygems_version = "1.8.10"
43
- s.summary = "You need a cache? Just throw me in."
44
-
45
- if s.respond_to? :specification_version then
46
- s.specification_version = 3
47
-
48
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
50
- s.add_development_dependency(%q<bundler>, [">= 0"])
51
- s.add_development_dependency(%q<jeweler>, [">= 0"])
52
- s.add_development_dependency(%q<simplecov>, [">= 0"])
53
- s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
54
- s.add_development_dependency(%q<timecop>, [">= 0"])
55
- s.add_development_dependency(%q<redis>, [">= 0"])
56
- else
57
- s.add_dependency(%q<sqlite3>, [">= 0"])
58
- s.add_dependency(%q<bundler>, [">= 0"])
59
- s.add_dependency(%q<jeweler>, [">= 0"])
60
- s.add_dependency(%q<simplecov>, [">= 0"])
61
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
62
- s.add_dependency(%q<timecop>, [">= 0"])
63
- s.add_dependency(%q<redis>, [">= 0"])
64
- end
65
- else
66
- s.add_dependency(%q<sqlite3>, [">= 0"])
67
- s.add_dependency(%q<bundler>, [">= 0"])
68
- s.add_dependency(%q<jeweler>, [">= 0"])
69
- s.add_dependency(%q<simplecov>, [">= 0"])
70
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
71
- s.add_dependency(%q<timecop>, [">= 0"])
72
- s.add_dependency(%q<redis>, [">= 0"])
73
- end
74
- end
75
-