memcache-client-activerecord 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +3 -3
  2. data/VERSION +1 -1
  3. data/lib/memcache/activerecord.rb +15 -8
  4. metadata +6 -6
data/Rakefile CHANGED
@@ -11,9 +11,9 @@ begin
11
11
  gem.homepage = "http://github.com/m4i/memcache-client-activerecord"
12
12
  gem.authors = ["ISHIHARA Masaki"]
13
13
  gem.rubyforge_project = "mc-activerecord"
14
- gem.add_runtime_dependency "activerecord", ">= 2.1"
15
- gem.add_development_dependency "rspec", ">= 1.2.9"
16
- gem.add_development_dependency "memcache-client", ">= 1.7.7"
14
+ gem.add_development_dependency "activerecord", "~> 2.1"
15
+ gem.add_development_dependency "rspec", ">= 1.3.0"
16
+ gem.add_development_dependency "memcache-client", ">= 1.7.8"
17
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
18
  end
19
19
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 1.0.0
@@ -223,23 +223,30 @@ class MemCache
223
223
  end
224
224
 
225
225
  def make_cache_key(key)
226
- if @autofix_keys && (key =~ /\s/ ||
227
- (key.length + (namespace.nil? ? 0 : namespace.length)) > MAX_KEY_SIZE)
226
+ if @autofix_keys && (key =~ /\s/ || key_length(key) > MAX_KEY_SIZE)
228
227
  key = "#{Digest::SHA1.hexdigest(key)}-autofixed"
229
228
  end
230
229
 
231
- key = namespace.nil? ?
230
+ cache_key = namespace.nil? ?
232
231
  key :
233
232
  "#{namespace}#{@namespace_separator}#{key}"
234
233
 
235
- if key =~ /\s/
236
- raise ArgumentError, "illegal character in key #{key.inspect}"
234
+ if cache_key =~ /\s/
235
+ raise ArgumentError, "illegal character in key #{cache_key.inspect}"
237
236
  end
238
- if key.length > MAX_KEY_SIZE
239
- raise ArgumentError, "key too long #{key.inspect}"
237
+ if cache_key.length > MAX_KEY_SIZE
238
+ raise ArgumentError, "key too long #{cache_key.inspect}"
240
239
  end
241
240
 
242
- key
241
+ cache_key
242
+ end
243
+
244
+ def key_length(key)
245
+ key.length + (
246
+ namespace.nil? ?
247
+ 0 :
248
+ namespace.length + @namespace_separator.to_s.length
249
+ )
243
250
  end
244
251
 
245
252
  def value_to_storable(value, raw)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcache-client-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ISHIHARA Masaki
@@ -9,16 +9,16 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-31 00:00:00 +09:00
12
+ date: 2010-02-06 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
17
- type: :runtime
17
+ type: :development
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
23
  version: "2.1"
24
24
  version:
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.9
33
+ version: 1.3.0
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: memcache-client
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.7.7
43
+ version: 1.7.8
44
44
  version:
45
45
  description: memcache-client-activerecord has the same interface as memcache-client, and provides the functionality of saving to ActiveRecord instead of Memcached.
46
46
  email: m.ishihara@gmail.com