bulk_cache_fetcher 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +2 -0
- data/lib/bulk_cache_fetcher.rb +2 -2
- data/test/bulk_cache_fetcher_test.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2012f42799511be205c0a27036b7a447dbf56b3
|
4
|
+
data.tar.gz: 54172b0aea06cbec9d7549bbe9963bb5ebcb7bea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea8c5960bc5df03785da93819ba29fae48390ccdcc5c6fae2fb25bb67b8e0052229e38e67eb3be8444a508c05c2573648ac22531f9aa5bcf9034087418d26102
|
7
|
+
data.tar.gz: 5142b31a0a0c5e8fab81ef56acabf45c35e44beade392b077950763e4abdff93ae521efcd070d39c7a36fd5727d5d95341629f8411c26623b9d784d185d3fc72
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# BulkCacheFetcher
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/justinweiss/bulk_cache_fetcher.png?branch=master)](https://travis-ci.org/justinweiss/bulk_cache_fetcher) [![Code Climate](https://codeclimate.com/github/justinweiss/bulk_cache_fetcher.png)](https://codeclimate.com/github/justinweiss/bulk_cache_fetcher)
|
4
|
+
|
3
5
|
Bulk Cache Fetcher fills the gap between [Russian doll caching](http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works) and the n+1 queries problem.
|
4
6
|
|
5
7
|
Russian doll caching is really great for handling views and
|
data/lib/bulk_cache_fetcher.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Rails' nested caching while avoiding the n+1 queries problem in the
|
6
6
|
# uncached case.
|
7
7
|
class BulkCacheFetcher
|
8
|
-
VERSION = '0.0.
|
8
|
+
VERSION = '0.0.3'
|
9
9
|
|
10
10
|
# Creates a new bulk cache fetcher, backed by +cache+. Cache must
|
11
11
|
# respond to the standard Rails cache API, described on
|
@@ -44,7 +44,7 @@ class BulkCacheFetcher
|
|
44
44
|
uncached_identifiers = object_identifiers.dup
|
45
45
|
|
46
46
|
cache_keys = cache_keys(object_identifiers)
|
47
|
-
found_objects = @cache.read_multi(cache_keys)
|
47
|
+
found_objects = @cache.read_multi(*cache_keys)
|
48
48
|
|
49
49
|
cache_keys.each do |cache_key|
|
50
50
|
cached_object = found_objects[cache_key]
|
@@ -10,7 +10,7 @@ class InMemoryCache
|
|
10
10
|
|
11
11
|
def read(key); cache[key]; end
|
12
12
|
def write(key, value, opts = {}); options[key] = opts; cache[key] = value; end
|
13
|
-
def read_multi(keys)
|
13
|
+
def read_multi(*keys)
|
14
14
|
results = {}
|
15
15
|
keys.each do |key|
|
16
16
|
results[key] = read(key) if read(key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulk_cache_fetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Weiss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
|
+
- .travis.yml
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|