aqila-cache 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +28 -32
- data/lib/aqila/cache.rb +8 -2
- data/lib/aqila/cache/configuration.rb +13 -0
- data/lib/aqila/cache/methods.rb +1 -1
- data/lib/aqila/cache/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d178c65d3d062a0ef64fbd97157dc9bc3bc91efbf3726a5f3fce5ba7887c06
|
4
|
+
data.tar.gz: bb11f74c1e4ca565779cf82ca86acfa8f1649d143e62933532ddf402bf6362f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a88ac3a544a96e45952d4ef13820015bd2d6ae0b995779b0ef399cbd9c3578cb0d66a79f614df5c3ec9835bb0121d0094e9204e670c3c53765564a6e8eed6b50
|
7
|
+
data.tar.gz: 26f21db4437a5ff008541e4bbcf6c7db912094544ad58c9f94033a00cc993a1db1a39b4637c3f3ae1e5523a6db060d9861dd35e1b6bc7b7bd3d924102ebcf25e
|
data/README.md
CHANGED
@@ -1,43 +1,39 @@
|
|
1
1
|
# Aqila::Cache
|
2
2
|
|
3
|
-
|
3
|
+
Invalidate the cache when the model data changes.
|
4
4
|
|
5
|
-
|
5
|
+
## Publish
|
6
6
|
|
7
|
-
|
7
|
+
`make release`
|
8
8
|
|
9
|
-
|
9
|
+
# Guide
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
Initializer:
|
12
|
+
```
|
13
|
+
Aqila::Cache.configure do |config|
|
14
|
+
config.configure_model do |model|
|
15
|
+
model.table_name = :ino_log_table
|
16
|
+
model.sequence_name = :gen_ino_log_table
|
17
|
+
end
|
18
|
+
config.default_ttl = 1.day
|
19
|
+
end
|
13
20
|
```
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install aqila-cache
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. 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
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aqila-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
|
-
|
37
|
-
## License
|
22
|
+
Example Model:
|
38
23
|
|
39
|
-
|
24
|
+
```
|
25
|
+
class Estadio < ActiveRecord::Base
|
26
|
+
include Aqila::Cache::Callbacks
|
40
27
|
|
41
|
-
|
28
|
+
self.cache_ttl = 1.day
|
29
|
+
...
|
30
|
+
end
|
31
|
+
```
|
42
32
|
|
43
|
-
|
33
|
+
Example Controller:
|
34
|
+
```
|
35
|
+
class V1::EstadiosController < ApplicationController
|
36
|
+
def index
|
37
|
+
return unless Estadio.stale?(controller: self)
|
38
|
+
...
|
39
|
+
```
|
data/lib/aqila/cache.rb
CHANGED
@@ -7,8 +7,14 @@ module Aqila
|
|
7
7
|
module Cache
|
8
8
|
class Error < StandardError; end
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
require 'aqila/cache/configuration'
|
11
|
+
|
12
|
+
def self.configuration
|
13
|
+
@configuration ||= Configuration.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configure
|
17
|
+
yield(configuration)
|
12
18
|
end
|
13
19
|
|
14
20
|
require 'aqila/cache/table_last_change'
|
data/lib/aqila/cache/methods.rb
CHANGED
data/lib/aqila/cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aqila-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agro1 Desenvolvimento
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- db/schema.rb
|
176
176
|
- lib/aqila/cache.rb
|
177
177
|
- lib/aqila/cache/callbacks.rb
|
178
|
+
- lib/aqila/cache/configuration.rb
|
178
179
|
- lib/aqila/cache/methods.rb
|
179
180
|
- lib/aqila/cache/table_last_change.rb
|
180
181
|
- lib/aqila/cache/version.rb
|