sprockets-cache-memcache 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .ruby-version
2
+ .rbenv-version
3
+ .rbenv-gemsets
4
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sprockets-cache-memcache.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sprockets-cache-memcache (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ sprockets-cache-memcache!
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012 Christoph Grabo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Sprockets Memcache Cache
2
+
3
+ A cache store for Sprockets which utilities Memcache.
4
+
5
+
6
+ ## Usage
7
+
8
+ Gemfile:
9
+
10
+ ```ruby
11
+ gem "sprockets"
12
+ gem "sprockets-cache-memcache"
13
+ # ...
14
+ ```
15
+
16
+ config.ru:
17
+
18
+ ```ruby
19
+ require "sprockets-cache-memcache"
20
+ env = Sprockets::Environment.new
21
+ env.cache = Sprockets::Cache::MemcacheStore.new(memcache, "sprockets")
22
+ # ...
23
+ ```
24
+
25
+ Where the first argument is a Memcache::Client connection, and the other (which is optional) is a key prefix.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,2 @@
1
+ require "sprockets-cache-memcache/version"
2
+ require "sprockets-cache-memcache/memcache_store"
@@ -0,0 +1,34 @@
1
+ module Sprockets
2
+ module Cache
3
+ # A simple Memcache cache store.
4
+ #
5
+ # environment.cache = Sprockets::Cache::MemcacheStore.new($redis)
6
+ #
7
+ class MemcacheStore
8
+
9
+ def initialize(memcache_conn, key_prefix = 'sprockets')
10
+ @memcache = memcache_conn
11
+ @key_prefix = key_prefix
12
+ end
13
+
14
+ # Lookup value in cache
15
+ def [](key)
16
+ data = @memcache.get path_for(key)
17
+ Marshal.load data if data
18
+ end
19
+
20
+ # Save value to cache
21
+ def []=(key, value)
22
+ @memcache.set path_for(key), Marshal.dump(value)
23
+ value
24
+ end
25
+
26
+ private
27
+
28
+ def path_for(key)
29
+ "#{@key_prefix}:#{key}"
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ module Sprockets
2
+ module Cache
3
+ module Memcache
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "sprockets-cache-memcache/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sprockets-cache-memcache"
7
+ s.version = Sprockets::Cache::Memcache::VERSION
8
+ s.authors = ["Christoph Grabo"]
9
+ s.email = ["chris@dinarrr.com"]
10
+ s.homepage = "https://github.com/CarrotCornCat/sprockets-cache-memcache"
11
+ s.summary = %q{A Memcache cache store for Sprockets}
12
+ s.description = %q{A Memcache cache store for Sprockets, built on the base of sprockets-cache-redis }
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sprockets-cache-memcache
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Christoph Grabo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-18 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ! 'A Memcache cache store for Sprockets, built on the base of sprockets-cache-redis '
15
+ email:
16
+ - chris@dinarrr.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - lib/sprockets-cache-memcache.rb
28
+ - lib/sprockets-cache-memcache/memcache_store.rb
29
+ - lib/sprockets-cache-memcache/version.rb
30
+ - sprockets-cache-memcache.gemspec
31
+ homepage: https://github.com/CarrotCornCat/sprockets-cache-memcache
32
+ licenses:
33
+ - MIT
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ segments:
45
+ - 0
46
+ hash: -3064073451950868841
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ segments:
54
+ - 0
55
+ hash: -3064073451950868841
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 1.8.23
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: A Memcache cache store for Sprockets
62
+ test_files: []