memorize 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.textile +2 -2
  2. data/Rakefile +1 -1
  3. data/lib/memorize/keys.rb +6 -0
  4. metadata +2 -2
@@ -30,8 +30,8 @@ See below my 'code-explanation':
30
30
  class ArticleSweeper < ActionController::Caching::Sweeper
31
31
  observe Article
32
32
  def after_save(article)
33
- Article.cache_entries(:index).each { |key| Rails.cache.delete(key) }
34
- Article.cache_entries(:show, :key => article.slug).each { |key| Rails.cache.delete(key) }
33
+ Article.cache_expires(:index)
34
+ Article.cache_expires(:show, :key => article.slug)
35
35
 
36
36
  Rails.cache.delete("my_key") #Memorize does not handle custom keys
37
37
  end
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake'
4
4
  require 'rake/gempackagetask'
5
5
 
6
6
  GEM = "memorize"
7
- GEM_VERSION = "0.2.0"
7
+ GEM_VERSION = "0.3.0"
8
8
  SUMMARY = "Allows Rails applications to do and control cache of actions"
9
9
  AUTHOR = "Roger Leite"
10
10
  EMAIL = "roger.barreto@gmail.com"
@@ -22,6 +22,12 @@ module Memorize
22
22
  group_key = build_group_key(group, options.delete(:key))
23
23
  Memorize.cache_store.read(group_key) || []
24
24
  end
25
+
26
+ def cache_expires(group, options = {})
27
+ group_key = build_group_key(group, options.delete(:key))
28
+ (Memorize.cache_store.read(group_key) || []).each { |key| Memorize.cache_store.delete(key) }
29
+ Memorize.cache_store.delete(group_key)
30
+ end
25
31
 
26
32
  private
27
33
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Roger Leite