simple_redis 0.3.0 → 0.3.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: d8f4c4a270c4100fa724e81a2388641ce7451bb6
4
- data.tar.gz: d6bac06fd91939654889fef9c61f2285aff7e92f
3
+ metadata.gz: ddba5472e05752f00d38dc247ba77669f9fed42e
4
+ data.tar.gz: 68845ea0122652b7ca63b7729b6f0538df4a4286
5
5
  SHA512:
6
- metadata.gz: d1f072180a13d933b95aae2749b6f21d9c51f9988e1ea18d7cfc39cd4c7916d98f848ea77c2574b8cdf8975c26e61cdbdd7bcee65a3288aec4133f00175dbf7c
7
- data.tar.gz: 4c13c46187c934d27393c9bd2666b9e36dcbbe7dc6fdee314015ec6fe903c000028fecaf8ff058c62164d0a30ba01f29409ae69c293f8585931e3068b23a2f78
6
+ metadata.gz: c665cc0242c0703986dc80f51cf5118a0aaea3b92200dcb49e4925af29a37fcf3a84303d54e2086af191707df3e8e7f8c19894d382f36e94a0a085de2f6ad0dc
7
+ data.tar.gz: b0d7e5b4450eabf58fbf67b291360ed765633d2e28676dc6d2edb6a331eb52eb480d6d6b513c3fb9f065cbcfcb8b6cf523c76a49af3a88c5a91ddee9c1967057
data/README.md CHANGED
@@ -20,8 +20,6 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install simple_redis
22
22
 
23
- _Please use stable version 0.3.0_
24
-
25
23
  ## Usage
26
24
 
27
25
  ### fetch
@@ -29,8 +27,9 @@ You can use key and value parameter to cache the data
29
27
 
30
28
  ```ruby
31
29
  SimpleRedis.fetch(key: 'department-list', value: Department.all)
30
+ # => [{name: 'Car'}, {name: 'Fashion'}, {name: 'Gadget'}]
32
31
  ```
33
- _Please note every cached object will be converted to json format using `to_json`_
32
+ _**Please note every cached object will be converted to json format using `to_json`**_
34
33
 
35
34
  OR You can use key and block to cache it
36
35
 
@@ -38,6 +37,7 @@ OR You can use key and block to cache it
38
37
  SimpleRedis.fetch(key: 'department-list') do
39
38
  Department.all
40
39
  end
40
+ # => [{name: 'Car'}, {name: 'Fashion'}, {name: 'Gadget'}]
41
41
  ```
42
42
 
43
43
  As default we will cache data under `simple-redis-cache` collection/database, but if you need to define it yourself, simply use `db` parameter, see the example
@@ -46,6 +46,7 @@ As default we will cache data under `simple-redis-cache` collection/database, bu
46
46
  SimpleRedis.fetch(db: 'important-db', key: 'department-list') do
47
47
  Department.all
48
48
  end
49
+ # => [{name: 'Car'}, {name: 'Fashion'}, {name: 'Gadget'}]
49
50
  ```
50
51
 
51
52
  ### set
@@ -53,6 +54,7 @@ You can simply just set value to a key, with this:
53
54
 
54
55
  ```ruby
55
56
  SimpleRedis.set('department-list', Department.all)
57
+ # => [{name: 'Car'}, {name: 'Fashion'}, {name: 'Gadget'}]
56
58
  ```
57
59
 
58
60
  ### get
@@ -60,6 +62,15 @@ Or you can just get value of a key with this
60
62
 
61
63
  ```ruby
62
64
  SimpleRedis.get('department-list')
65
+ # => [{name: 'Car'}, {name: 'Fashion'}, {name: 'Gadget'}]
66
+ ```
67
+
68
+ ### total_matches
69
+ Total matches used to see how many key matched with our keyword, e.g:
70
+
71
+ ```ruby
72
+ SimpleRedis.total_matches('department/*')
73
+ # => 3
63
74
  ```
64
75
 
65
76
  ### delete_matched
@@ -67,12 +78,14 @@ This method remove a data based on key such as:
67
78
 
68
79
  ```ruby
69
80
  SimpleRedis.delete_matched('department/fashion')
81
+ # => 1
70
82
  ```
71
83
 
72
84
  OR you can use regex
73
85
 
74
86
  ```ruby
75
87
  SimpleRedis.delete_matched('department/*')
88
+ # => 3
76
89
  ```
77
90
 
78
91
  ## Configuration
@@ -93,6 +106,7 @@ And you can change those 3 configurations on the fly, example:
93
106
  SimpleRedis.fetch(db: 'important-db', key: 'department-list', host: 'redis_host', port: 'redis_port') do
94
107
  Department.all
95
108
  end
109
+ # => [{name: 'Car'}, {name: 'Fashion'}, {name: 'Gadget'}]
96
110
  ```
97
111
 
98
112
  ## Development
@@ -0,0 +1,6 @@
1
+ module SimpleRedis
2
+ HOST = "localhost"
3
+ PORT = 6379
4
+ DEFAULT_DB = "0"
5
+ NORMAL_DATA_TYPES = [String, Fixnum, Integer, Float, NilClass, Symbol, Range]
6
+ end
@@ -1,7 +1,3 @@
1
1
  module SimpleRedis
2
- VERSION = "0.3.0"
3
- HOST = "localhost"
4
- PORT = 6379
5
- DEFAULT_DB = "0"
6
- NORMAL_DATA_TYPES = [String, Fixnum, Integer, Float, NilClass, Symbol, Range]
2
+ VERSION = "0.3.1"
7
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aditia Mahdar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-13 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -63,6 +63,7 @@ files:
63
63
  - README.md
64
64
  - Rakefile
65
65
  - lib/simple_redis.rb
66
+ - lib/simple_redis/constant.rb
66
67
  - lib/simple_redis/version.rb
67
68
  - lib/tasks/simple_redis_tasks.rake
68
69
  - test/dummy/README.rdoc