activerecord_cache_store 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -15,7 +15,19 @@ Cache Migration
15
15
  ===============
16
16
 
17
17
  rails g cache_migration
18
+ rake db:migrate
18
19
 
20
+ Usage
21
+ =====
22
+
23
+ <% cache do %>
24
+ some html
25
+ <% end>
26
+
27
+ Rails.cache.clear # clear all cache
28
+ Rails.cache.cleanup # clear expired cache entries
29
+
30
+ more about Rails caching http://guides.rubyonrails.org/caching_with_rails.html
19
31
 
20
32
  Notes
21
33
  =====
@@ -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.1"
6
+ s.version = "0.0.2"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Tomasz Mazur"]
9
9
  s.email = ["defkode@gmail.com"]
@@ -5,26 +5,26 @@ module ActiveSupport
5
5
  class ActiveRecordStore < Store
6
6
 
7
7
  def cleanup(options = nil)
8
- ::CacheEntry.expired.delete_all
8
+ CacheEntry.expired.delete_all
9
9
  end
10
10
 
11
11
  def clear(options = nil)
12
- ::CacheEntry.delete_all
12
+ CacheEntry.delete_all
13
13
  end
14
14
 
15
15
  private
16
16
 
17
17
  def read_entry(key, options)
18
- if entry = ::CacheEntry.find_by_key(key)
18
+ if entry = CacheEntry.find_by_key(key)
19
19
  entry.to_cache_entry
20
20
  end
21
21
  end
22
22
 
23
23
  def write_entry(key, entry, options)
24
- if cache = ::CacheEntry.find_by_key(key)
24
+ if cache = CacheEntry.find_by_key(key)
25
25
  delete_entry(key, {})
26
26
  end
27
- ::CacheEntry.create!({
27
+ CacheEntry.create!({
28
28
  :key => key,
29
29
  :value => entry.value,
30
30
  :created_at => entry.created_at,
@@ -33,8 +33,7 @@ module ActiveSupport
33
33
  end
34
34
 
35
35
  def delete_entry(key, options)
36
- puts "DELETE"
37
- ::CacheEntry.where(:key => key).delete_all
36
+ CacheEntry.where(:key => key).delete_all
38
37
  end
39
38
  end
40
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_cache_store
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tomasz Mazur