caching 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +15 -3
- data/README.md +30 -28
- data/caching.gemspec +2 -0
- data/lib/caching.rb +1 -0
- data/lib/caching/storage.rb +3 -2
- data/lib/caching/version.rb +1 -1
- metadata +36 -33
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dcb2dceed3f700d8a747edd6f48549b2c20b4dc8af74deb8b1f4797348e70a37
|
4
|
+
data.tar.gz: 6a1f242c3ccaadcf38b8001e7e2d485aee36ea909cc294a9f5854d2459f4cd81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 80a46e74b0869f519ed7cffaf69a006ad453596b7120aa0b4ff7dcaeb13009a2eabc7f089a916c9da3a0edacdad1a9c5bdf78929a859a6fd45f6f9810a65df32
|
7
|
+
data.tar.gz: 9dd910bbea3cbcf06fdb759162f8b478510e7ebd91be8f20d9791aa61c4d0231d733747dcae04d4b99d8c7e42a9c150c1baa90f90a386a751857f35aa68793ab
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
caching
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.5.0
|
data/.travis.yml
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.2
|
4
|
-
- 1.9.3
|
5
3
|
- 2.0
|
6
|
-
-
|
4
|
+
- 2.1
|
5
|
+
- 2.2
|
6
|
+
- 2.3.0
|
7
|
+
- 2.4.0
|
8
|
+
- 2.5.0
|
9
|
+
- 2.6.0
|
10
|
+
- ruby-head
|
11
|
+
|
12
|
+
matrix:
|
13
|
+
fast_finish: true
|
14
|
+
allow_failures:
|
15
|
+
- rvm: ruby-head
|
16
|
+
|
17
|
+
before_install:
|
18
|
+
- gem install bundler -v "< 2"
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Caching
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/caching.
|
4
|
-
[![Build Status](https://travis-ci.org/gabynaiman/caching.
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/gabynaiman/caching/badge.
|
6
|
-
[![Code Climate](https://codeclimate.com/github/gabynaiman/caching.
|
7
|
-
[![Dependency Status](https://gemnasium.com/gabynaiman/caching.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/caching.svg)](https://rubygems.org/gems/caching)
|
4
|
+
[![Build Status](https://travis-ci.org/gabynaiman/caching.svg?branch=master)](https://travis-ci.org/gabynaiman/caching)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/gabynaiman/caching/badge.svg?branch=master)](https://coveralls.io/r/gabynaiman/caching?branch=master)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/gabynaiman/caching.svg)](https://codeclimate.com/github/gabynaiman/caching)
|
7
|
+
[![Dependency Status](https://gemnasium.com/gabynaiman/caching.svg)](https://gemnasium.com/gabynaiman/caching)
|
8
8
|
|
9
9
|
Cache methods
|
10
10
|
|
@@ -24,36 +24,38 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
```ruby
|
28
|
+
class Model
|
29
|
+
def slow_method
|
30
|
+
...
|
31
|
+
end
|
32
|
+
cache_method :slow_method
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def slow_method_with_args(*args)
|
35
|
+
...
|
36
|
+
end
|
37
|
+
cache_method :slow_method_with_args
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
def fast_method
|
40
|
+
...
|
41
|
+
end
|
42
|
+
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
model.slow_method # => Execute method
|
46
|
-
model.slow_method # => Return cached value
|
44
|
+
model = Model.new
|
47
45
|
|
48
|
-
|
49
|
-
|
46
|
+
model.slow_method # => Execute method
|
47
|
+
model.slow_method # => Return cached value
|
50
48
|
|
51
|
-
|
52
|
-
|
49
|
+
model.slow_method_with_args 'some value' # => Execute method
|
50
|
+
model.slow_method_with_args 'some value' # => Return cached value for argument 'some value'
|
53
51
|
|
54
|
-
|
52
|
+
model.slow_method_with_args 1234 # => Execute method
|
53
|
+
model.slow_method_with_args 1234 # => Return cached value for argument 1234
|
55
54
|
|
56
|
-
|
55
|
+
model.clear_cache :slow_method # => Remove cache only for method slow_method
|
56
|
+
|
57
|
+
model.clear_cache # => Remove cache for all cached methods
|
58
|
+
```
|
57
59
|
|
58
60
|
## Contributing
|
59
61
|
|
data/caching.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_runtime_dependency "concurrent-ruby"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
24
|
spec.add_development_dependency "rake"
|
23
25
|
spec.add_development_dependency "minitest", "~> 4.7"
|
data/lib/caching.rb
CHANGED
data/lib/caching/storage.rb
CHANGED
data/lib/caching/version.rb
CHANGED
metadata
CHANGED
@@ -1,94 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gabriel Naiman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2019-01-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
14
27
|
- !ruby/object:Gem::Dependency
|
15
28
|
name: bundler
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
30
|
requirements:
|
19
|
-
- - ~>
|
31
|
+
- - "~>"
|
20
32
|
- !ruby/object:Gem::Version
|
21
33
|
version: '1.3'
|
22
34
|
type: :development
|
23
35
|
prerelease: false
|
24
36
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
37
|
requirements:
|
27
|
-
- - ~>
|
38
|
+
- - "~>"
|
28
39
|
- !ruby/object:Gem::Version
|
29
40
|
version: '1.3'
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: rake
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
|
-
- -
|
45
|
+
- - ">="
|
36
46
|
- !ruby/object:Gem::Version
|
37
47
|
version: '0'
|
38
48
|
type: :development
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
|
-
- -
|
52
|
+
- - ">="
|
44
53
|
- !ruby/object:Gem::Version
|
45
54
|
version: '0'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: minitest
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
|
-
- - ~>
|
59
|
+
- - "~>"
|
52
60
|
- !ruby/object:Gem::Version
|
53
61
|
version: '4.7'
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
|
-
- - ~>
|
66
|
+
- - "~>"
|
60
67
|
- !ruby/object:Gem::Version
|
61
68
|
version: '4.7'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: turn
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- - ~>
|
73
|
+
- - "~>"
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0.9'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- - ~>
|
80
|
+
- - "~>"
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0.9'
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: simplecov
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
|
-
- -
|
87
|
+
- - ">="
|
84
88
|
- !ruby/object:Gem::Version
|
85
89
|
version: '0'
|
86
90
|
type: :development
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
|
-
- -
|
94
|
+
- - ">="
|
92
95
|
- !ruby/object:Gem::Version
|
93
96
|
version: '0'
|
94
97
|
description: Cache methods
|
@@ -98,9 +101,11 @@ executables: []
|
|
98
101
|
extensions: []
|
99
102
|
extra_rdoc_files: []
|
100
103
|
files:
|
101
|
-
- .coveralls.yml
|
102
|
-
- .gitignore
|
103
|
-
- .
|
104
|
+
- ".coveralls.yml"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
108
|
+
- ".travis.yml"
|
104
109
|
- Gemfile
|
105
110
|
- LICENSE.txt
|
106
111
|
- README.md
|
@@ -116,31 +121,29 @@ files:
|
|
116
121
|
homepage: https://github.com/gabynaiman/caching
|
117
122
|
licenses:
|
118
123
|
- MIT
|
124
|
+
metadata: {}
|
119
125
|
post_install_message:
|
120
126
|
rdoc_options: []
|
121
127
|
require_paths:
|
122
128
|
- lib
|
123
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
130
|
requirements:
|
126
|
-
- -
|
131
|
+
- - ">="
|
127
132
|
- !ruby/object:Gem::Version
|
128
133
|
version: '0'
|
129
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
135
|
requirements:
|
132
|
-
- -
|
136
|
+
- - ">="
|
133
137
|
- !ruby/object:Gem::Version
|
134
138
|
version: '0'
|
135
139
|
requirements: []
|
136
140
|
rubyforge_project:
|
137
|
-
rubygems_version:
|
141
|
+
rubygems_version: 2.7.3
|
138
142
|
signing_key:
|
139
|
-
specification_version:
|
143
|
+
specification_version: 4
|
140
144
|
summary: Cache methods
|
141
145
|
test_files:
|
142
146
|
- spec/caching_spec.rb
|
143
147
|
- spec/coverage_helper.rb
|
144
148
|
- spec/minitest_helper.rb
|
145
149
|
- spec/storage_spec.rb
|
146
|
-
has_rdoc:
|