sprockets-cache-redis 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,17 +2,23 @@ require 'digest/md5'
2
2
 
3
3
  module Sprockets
4
4
  module Cache
5
+ # A simple Redis cache store.
6
+ #
7
+ # environment.cache = Sprockets::Cache::RedisStore.new($redis)
8
+ #
5
9
  class RedisStore
6
10
  def initialize(redis_conn, key_prefix = 'sprockets')
7
11
  @redis = redis_conn
8
12
  @key_prefix = key_prefix
9
13
  end
10
14
 
15
+ # Lookup value in cache
11
16
  def [](key)
12
17
  data = @redis.get path_for(key)
13
18
  Marshal.load data if data
14
19
  end
15
20
 
21
+ # Save value to cache
16
22
  def []=(key, value)
17
23
  @redis.set path_for(key), Marshal.dump(value)
18
24
  end
@@ -1,7 +1,7 @@
1
1
  module Sprockets
2
2
  module Cache
3
3
  module Redis
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-cache-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: