multi_cache 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -10
- data/lib/multi_cache/version.rb +1 -1
- data/multi_cache-0.1.0.gem +0 -0
- data/multi_cache.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a7177cba4599c246887fff21c95f74bb6824a33
|
4
|
+
data.tar.gz: 5ee77e35dc0158d261b5274a315f14006c058b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 630ec8d1b446bbc2d51fc8d7193643d9b3d40e63ecc78689bedb43ef0b73fc7b659d23b16c0a829199fccd211bfcd4f12ccc214ff97749fb2baef14aca6fc605
|
7
|
+
data.tar.gz: cbabc056f51cee3f6f1a437aa0171df128b671c4f7e269f80728280e5a8c087b374105d21fd9947905778d28e5cfccf6a9265224f412956787806028fbf08afa
|
data/README.md
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# MultiCache
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/multi_cache`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
@@ -22,17 +18,48 @@ Or install it yourself as:
|
|
22
18
|
|
23
19
|
## Usage
|
24
20
|
|
25
|
-
|
21
|
+
After installing, the gem:
|
22
|
+
|
23
|
+
Create config/initializers/init_multi_cache.rb
|
24
|
+
and add the lines
|
25
|
+
|
26
|
+
MultiCache.configure do |config|
|
27
|
+
config.redis_instance "<redis-instance>"
|
28
|
+
end
|
29
|
+
|
30
|
+
where <redis-instance> is the Redis::Namespace object to be used by
|
31
|
+
MultiCache for caching
|
32
|
+
Please ensure that the <redis-instance> is wrapped in quotes
|
33
|
+
|
34
|
+
|
35
|
+
All models where you want to use MultiCache must:
|
36
|
+
|
37
|
+
[mandatory] Define a CLASS method
|
38
|
+
MULTI_CACHE_PREFIXES
|
39
|
+
that returns an array of allowed cache prefixes used by
|
40
|
+
the class
|
41
|
+
|
42
|
+
[mandatory] Define a CLASS method
|
43
|
+
GEN_CACHE_CONTENT(ID_OR_OBJ, CACHE_PREFIX)
|
44
|
+
that generates a hash that will be cached
|
45
|
+
ID_OR_OBJ is a hash that contains
|
46
|
+
{:id => obj_id, :obj => actual_obj_if_available}
|
47
|
+
CACHE_PREFIX is an optional string that can be used to
|
48
|
+
distinguish between different cached info for the same
|
49
|
+
object.
|
50
|
+
|
51
|
+
[optional] Define a CLASS method
|
52
|
+
PARSE_CACHE_CONTENT(CONTENT, CACHE_PREFIX)
|
53
|
+
that parses the cached content once it is read from
|
54
|
+
redis. Sometimes some JSON.parses are required. If not
|
55
|
+
defined, the default method is called (which simply returns
|
56
|
+
the cached value as-is)
|
26
57
|
|
27
58
|
## Development
|
28
59
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
60
|
## Contributing
|
34
61
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/peerlearning/multi_cache. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
63
|
|
37
64
|
|
38
65
|
## License
|
data/lib/multi_cache/version.rb
CHANGED
Binary file
|
data/multi_cache.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akshay Rao
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- bin/setup
|
84
84
|
- lib/multi_cache.rb
|
85
85
|
- lib/multi_cache/version.rb
|
86
|
+
- multi_cache-0.1.0.gem
|
86
87
|
- multi_cache.gemspec
|
87
88
|
homepage: http://www.avanti.in
|
88
89
|
licenses:
|