multi_cache 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5096bde42ac1c729f9cd1cd5ca3464192764489
4
- data.tar.gz: 60872b70e75c847eccacb50b327a84fb28d64caf
3
+ metadata.gz: 9a7177cba4599c246887fff21c95f74bb6824a33
4
+ data.tar.gz: 5ee77e35dc0158d261b5274a315f14006c058b7b
5
5
  SHA512:
6
- metadata.gz: 90c47d38f5efe8ad9c773e634a3c771627a9b5d0ae1ec665642a9ebd386df2f2a2ba496911cda0fc1444c5a9a664bed18c2bd59a5434d444e7c084320c63311c
7
- data.tar.gz: 5f60c3c7e6c84bc07b45c91fb0383d1ab5da2043c63e45a3e6933e3611017b56d9e3e1c02dde56f1be4e78072abd7b654e7dc2e64239f6e0e2218194233cab63
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
- TODO: Write usage instructions here
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/[USERNAME]/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.
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
@@ -1,3 +1,3 @@
1
1
  module MultiCache
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
Binary file
data/multi_cache.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'multi_cache/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "multi_cache"
8
- spec.version = MultiCache::VERSION
8
+ spec.version = '0.1.1'
9
9
  spec.authors = ["Akshay Rao"]
10
10
  spec.email = ["14akshayrao@gmail.com"]
11
11
 
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.0
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: