reredis 0.0.1 → 0.0.2
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 +8 -8
- data/README.md +29 -1
- data/lib/reredis.rb +0 -1
- data/lib/reredis/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWQyNzVkMTlmMTkzMWRmZmIxZjkwYjA4MGExYmQ4YjExM2QzZWUzYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjEzZWVkYjYwNzlhMzRmNjJiMzliODc1NzI0ZTViNjViZjEzNjkxMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTVlMGRkYjk5NjUzNWY5OWQwNDkzMmVhYzgzYjU0ZDkwZjUxYTI4ZDY2YjNl
|
10
|
+
YTdmMDNlZjFhOWZlYTQxYWQ0OGMzODIzZWM2NjU1MDhhZTVlMTcyYzUwODk5
|
11
|
+
NTZmOGY2ODgyMjk5NDkyNDk5ZDhiYjk1NmM4NDQwZjQwZjJlMDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2I0OGQwOTE0OGUxYTQ0ODYxM2UzODkwMjEyZWZkZmIzMjQwYTFhODUzYmJi
|
14
|
+
Mzk5NjBlZjcxN2QyYmMyNWVlOTAxMjI1YjJkYmE1ZGIxN2M1NGE1OGE2ZGEy
|
15
|
+
NjQwZDQwNTgzNGJkNGJjNGIyODhiODM2ZjI3NWY2NTg3YTYxN2Y=
|
data/README.md
CHANGED
@@ -10,13 +10,41 @@ Add this line to your application's Gemfile:
|
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
13
|
-
$ bundle
|
13
|
+
$ bundle install
|
14
14
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
17
|
$ gem install reredis
|
18
18
|
|
19
19
|
## Usage
|
20
|
+
A custorm gem redis- it include redis object and some sample counter for model : photo,user using Redis
|
21
|
+
|
22
|
+
To use redis object
|
23
|
+
Add this line to your application's active record model
|
24
|
+
$ include Reredis::Model::RedisObject
|
25
|
+
|
26
|
+
To use User's counter and relation sample
|
27
|
+
$ include Reredis::Model::User::Counter
|
28
|
+
$ include Reredis::Model::User::Relation
|
29
|
+
|
30
|
+
To user Photo's counter sample
|
31
|
+
$ include Reredis::Model::Photo::Counter
|
32
|
+
|
33
|
+
You can test in rails console
|
34
|
+
# Photo.first.likes_count
|
35
|
+
# Photo.first.comments_count
|
36
|
+
# Photo.first.pins_count
|
37
|
+
# User.first.get_followers_status
|
38
|
+
# User.first.get_likes_status
|
39
|
+
|
40
|
+
Using method mget of Redis to get information
|
41
|
+
|
42
|
+
Something like this :
|
43
|
+
# @likes_count = Reredis.mget(photos, "likes_count")
|
44
|
+
# @pins_count = Reredis.mget(photos, "pins_count")
|
45
|
+
# @comments_count = Reredis.mget(photos, "comments_count")
|
46
|
+
|
47
|
+
|
20
48
|
|
21
49
|
|
22
50
|
## Contributing
|
data/lib/reredis.rb
CHANGED
@@ -23,7 +23,6 @@ module Reredis
|
|
23
23
|
$redis_statistics = Redis.new(:host => ENV['CACHE_REDIS_TRACK_STATISTICS'], :port => 6379, :db => 2)
|
24
24
|
end
|
25
25
|
|
26
|
-
# if redis error or flushdb, please run rake redis:run_after_flushdb
|
27
26
|
def self.mget(objects, str)
|
28
27
|
hash = Hash.new
|
29
28
|
return hash if objects.blank?
|
data/lib/reredis/version.rb
CHANGED