activerecord_cache_store 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ activerecord_cache_store (0.0.5)
5
+ activerecord (>= 3.0.0)
6
+ activesupport (>= 3.0.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ activemodel (3.1.3)
12
+ activesupport (= 3.1.3)
13
+ builder (~> 3.0.0)
14
+ i18n (~> 0.6)
15
+ activerecord (3.1.3)
16
+ activemodel (= 3.1.3)
17
+ activesupport (= 3.1.3)
18
+ arel (~> 2.2.1)
19
+ tzinfo (~> 0.3.29)
20
+ activesupport (3.1.3)
21
+ multi_json (~> 1.0)
22
+ arel (2.2.1)
23
+ builder (3.0.0)
24
+ i18n (0.6.0)
25
+ multi_json (1.0.4)
26
+ tzinfo (0.3.31)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ activerecord_cache_store!
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "activerecord_cache_store"
6
- s.version = "0.0.5"
6
+ s.version = "0.0.6"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Tomasz Mazur"]
9
9
  s.email = ["defkode@gmail.com"]
@@ -2,7 +2,6 @@ class CacheEntry < ActiveRecord::Base
2
2
  set_table_name :cache
3
3
 
4
4
  validates :key, :presence => true, :uniqueness => true
5
- validates :value, :presence => true
6
5
  validates :created_at, :presence => true
7
6
 
8
7
  scope :expired, lambda { where("expires_at < ?", Time.now.to_f) }
@@ -12,6 +11,6 @@ class CacheEntry < ActiveRecord::Base
12
11
  end
13
12
 
14
13
  def to_cache_entry
15
- ActiveSupport::Cache::Entry.create(value, created_at, :expires_in => expires_in)
14
+ ActiveSupport::Cache::Entry.create(value, created_at, :expires_in => expires_in, :compressed => is_compressed)
16
15
  end
17
- end
16
+ end
@@ -21,15 +21,19 @@ module ActiveSupport
21
21
  end
22
22
 
23
23
  def write_entry(key, entry, options)
24
- if cache = CacheEntry.find_by_key(key)
24
+ if CacheEntry.find_by_key(key)
25
25
  delete_entry(key, {})
26
26
  end
27
27
  CacheEntry.create!({
28
- :key => key,
29
- :value => entry.value,
30
- :created_at => entry.created_at,
31
- :expires_at => entry.expires_at
28
+ :key => key,
29
+ :value => entry.raw_value,
30
+ :created_at => entry.created_at,
31
+ :expires_at => entry.expires_at,
32
+ :is_compressed => entry.compressed?
32
33
  })
34
+ rescue ActiveRecord::ActiveRecordError => e
35
+ logger.error("ActiveRecordCacheError (#{e}): #{e.message}") if logger
36
+ false
33
37
  end
34
38
 
35
39
  def delete_entry(key, options)
@@ -2,9 +2,10 @@ class CreateCache < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :cache do |t|
4
4
  t.string :key
5
- t.text :value
6
- t.float :created_at
7
- t.float :expires_at
5
+ t.binary :value
6
+ t.decimal :created_at, :precision => 15, :scale => 5
7
+ t.decimal :expires_at, :precision => 15, :scale => 5
8
+ t.boolean :is_compressed
8
9
  end
9
10
 
10
11
  add_index :cache, :key, :unique => true
@@ -14,9 +15,5 @@ class CreateCache < ActiveRecord::Migration
14
15
 
15
16
  def self.down
16
17
  drop_table :cache
17
-
18
- remove_index :cache, :key
19
- remove_index :cache, :created_at
20
- remove_index :cache, :expires_at
21
18
  end
22
19
  end
metadata CHANGED
@@ -1,67 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activerecord_cache_store
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Tomasz Mazur
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-12-07 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-12-02 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: activerecord
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70224061791100 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
34
21
  version: 3.0.0
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: activesupport
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70224061791100
25
+ - !ruby/object:Gem::Dependency
26
+ name: activesupport
27
+ requirement: &70224061790300 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 7
46
- segments:
47
- - 3
48
- - 0
49
- - 0
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
50
32
  version: 3.0.0
51
33
  type: :runtime
52
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *70224061790300
53
36
  description: stores cache in database
54
- email:
37
+ email:
55
38
  - defkode@gmail.com
56
39
  executables: []
57
-
58
40
  extensions: []
59
-
60
41
  extra_rdoc_files: []
61
-
62
- files:
42
+ files:
63
43
  - .gitignore
64
44
  - Gemfile
45
+ - Gemfile.lock
65
46
  - README
66
47
  - Rakefile
67
48
  - activerecord_cache_store.gemspec
@@ -70,39 +51,28 @@ files:
70
51
  - lib/active_support/cache/active_record_store.rb
71
52
  - lib/generators/cache_migration_generator.rb
72
53
  - lib/generators/templates/migration.rb
73
- has_rdoc: true
74
54
  homepage: https://github.com/defkode/activerecord_cache_store
75
55
  licenses: []
76
-
77
56
  post_install_message:
78
57
  rdoc_options: []
79
-
80
- require_paths:
58
+ require_paths:
81
59
  - lib
82
- required_ruby_version: !ruby/object:Gem::Requirement
60
+ required_ruby_version: !ruby/object:Gem::Requirement
83
61
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
- required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
67
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
- version: "0"
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
100
72
  requirements: []
101
-
102
73
  rubyforge_project: activerecord_cache_store
103
- rubygems_version: 1.3.7
74
+ rubygems_version: 1.8.11
104
75
  signing_key:
105
76
  specification_version: 3
106
77
  summary: ActiveRecord Cache Store for Rails 3
107
78
  test_files: []
108
-