sprockets-cache-redis-devio 0.0.4

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 197b18ef14d061a0796fd1fda533d36586d9a7a1
4
+ data.tar.gz: 59209c55c7640c15a7610c8d7d3b3b81a608b74e
5
+ SHA512:
6
+ metadata.gz: 4256b3122fd8aa1cdfeff345f84d1490fbd16ba81e67da4943b46bcea4bed90fc25e9d9728352290a499b514ffaf1d8422e30e8d15bbabd226d8d026b0d8df49
7
+ data.tar.gz: 98bc551437c09efeb5fb99505a0e41bbb2edd88f07f66ddf4bd5123541c956ae673aaf5b81bdf39b784bdc4328008715e0dbcb3271520dd4f6e9514908e396e8
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sprockets-cache-redis.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,47 @@
1
+ Sprockets Redis Cache
2
+ ====================
3
+
4
+ A cache store for Sprockets which utilities Redis.
5
+
6
+ Usage
7
+ -----
8
+
9
+ Gemfile:
10
+
11
+ gem 'sprockets'
12
+ gem 'sprockets-cache-redis'
13
+ ...
14
+
15
+ config.ru:
16
+
17
+ require 'sprockets-cache-redis'
18
+ env = Sprockets::Environment.new
19
+ env.cache = Sprockets::Cache::RedisStore.new(redis, 'sprockets')
20
+ ...
21
+
22
+ Where the first argument is a Redis connection, and the other (which is optional) is a key_prefix.
23
+
24
+ License
25
+ -------
26
+ (MIT license)
27
+
28
+ Copyright (C) 2011 by Carl Hörberg
29
+
30
+ Permission is hereby granted, free of charge, to any person obtaining a copy
31
+ of this software and associated documentation files (the "Software"), to deal
32
+ in the Software without restriction, including without limitation the rights
33
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34
+ copies of the Software, and to permit persons to whom the Software is
35
+ furnished to do so, subject to the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be included in
38
+ all copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
46
+ THE SOFTWARE.
47
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,2 @@
1
+ require "sprockets-cache-redis/version"
2
+ require "sprockets-cache-redis/redis_store"
@@ -0,0 +1,31 @@
1
+ module Sprockets
2
+ class Cache
3
+ # A simple Redis cache store.
4
+ #
5
+ # environment.cache = Sprockets::Cache::RedisStore.new($redis)
6
+ #
7
+ class RedisStore
8
+ def initialize(redis_conn, key_prefix = 'sprockets')
9
+ @redis = redis_conn
10
+ @key_prefix = key_prefix
11
+ end
12
+
13
+ # Lookup value in cache
14
+ def [](key)
15
+ data = @redis.get path_for(key)
16
+ Marshal.load data if data
17
+ end
18
+
19
+ # Save value to cache
20
+ def []=(key, value)
21
+ @redis.set path_for(key), Marshal.dump(value)
22
+ value
23
+ end
24
+
25
+ private
26
+ def path_for(key)
27
+ "#{@key_prefix}:#{key}"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,7 @@
1
+ module Sprockets
2
+ class Cache
3
+ module Redis
4
+ VERSION = "0.0.4"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "sprockets-cache-redis/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sprockets-cache-redis-devio"
7
+ s.version = Sprockets::Cache::Redis::VERSION
8
+ s.authors = ["Carl Hörberg", "Devio, LLC"]
9
+ s.email = ["carl.hoerberg@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{A Redis cache store for Sprockets}
12
+ s.description = %q{}
13
+
14
+ s.rubyforge_project = "sprockets-cache-redis"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sprockets-cache-redis-devio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Carl Hörberg
8
+ - Devio, LLC
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-09-22 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ''
15
+ email:
16
+ - carl.hoerberg@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - README.markdown
24
+ - Rakefile
25
+ - lib/sprockets-cache-redis.rb
26
+ - lib/sprockets-cache-redis/redis_store.rb
27
+ - lib/sprockets-cache-redis/version.rb
28
+ - sprockets-cache-redis.gemspec
29
+ homepage: ''
30
+ licenses: []
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project: sprockets-cache-redis
48
+ rubygems_version: 2.4.8
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: A Redis cache store for Sprockets
52
+ test_files: []