flipper-active_support_cache_store 0.22.2 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d74e7c9f7578b80da90652110f50049f2d80ada2c3f1bdd0a497f4fe03b85fd
|
4
|
+
data.tar.gz: a45f483537584f9479c74f18302a965ef03151e5588ab69a0e7ac70e7aa4d4f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f2f45908d9ba8d757c023d30fdf382052b3dd05708bb106915cb7aa7359378fc2d4500d84c5d01c4a5a5f6d56bc9c862989ddbe21bbe8adf6cab27548d0fbc4
|
7
|
+
data.tar.gz: '09fde3bca19d4f409848666108be7ed16c3cca02296115f65f46bdd3094d3d3afecc94c714a4212464e8e2d4720451f1e03b57502b504e159f5e3ed884d84249'
|
data/lib/flipper/version.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
require 'helper'
|
2
1
|
require 'active_support/cache'
|
3
2
|
require 'active_support/cache/dalli_store'
|
4
3
|
require 'flipper/adapters/operation_logger'
|
5
4
|
require 'flipper/adapters/active_support_cache_store'
|
6
|
-
require 'flipper/spec/shared_adapter_specs'
|
7
5
|
|
8
6
|
RSpec.describe Flipper::Adapters::ActiveSupportCacheStore do
|
9
7
|
let(:memory_adapter) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-active_support_cache_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.23.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.23.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '4.2'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '8'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '4.2'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '8'
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- nunemaker@gmail.com
|
@@ -51,7 +51,6 @@ executables: []
|
|
51
51
|
extensions: []
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
|
-
- docs/active_support_cache_store/README.md
|
55
54
|
- flipper-active_support_cache_store.gemspec
|
56
55
|
- lib/flipper-active_support_cache_store.rb
|
57
56
|
- lib/flipper/adapters/active_support_cache_store.rb
|
@@ -77,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
76
|
- !ruby/object:Gem::Version
|
78
77
|
version: '0'
|
79
78
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.1.2
|
81
80
|
signing_key:
|
82
81
|
specification_version: 4
|
83
82
|
summary: ActiveSupport::Cache store adapter for Flipper
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# Flipper ActiveSupportCacheStore
|
2
|
-
|
3
|
-
An [ActiveSupportCacheStore](http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html) adapter for [Flipper](https://github.com/jnunemaker/flipper).
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'flipper-active_support_cache_store'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself with:
|
16
|
-
|
17
|
-
$ gem install flipper-active_support_cache_store
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
require 'active_support/cache'
|
23
|
-
require 'flipper/adapters/active_support_cache_store'
|
24
|
-
|
25
|
-
Flipper.configure do |config|
|
26
|
-
config.adapter do
|
27
|
-
Flipper::Adapters::ActiveSupportCacheStore.new(
|
28
|
-
Flipper::Adapters::Memory.new,
|
29
|
-
ActiveSupport::Cache::MemoryStore.new, # Or Rails.cache
|
30
|
-
expires_in: 5.minutes
|
31
|
-
)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
```
|
35
|
-
|
36
|
-
Setting `expires_in` is optional and will set an expiration time on Flipper cache keys. If specified, all flipper keys will use this `expires_in` over the `expires_in` passed to your ActiveSupport cache constructor.
|
37
|
-
|
38
|
-
## Internals
|
39
|
-
|
40
|
-
Each feature is stored in the underlying cache store.
|
41
|
-
|
42
|
-
This is an example using `ActiveSupport::Cache::MemoryStore` with the [Flipper memory adapter](https://github.com/jnunemaker/flipper/blob/master/lib/flipper/adapters/memory.rb).
|
43
|
-
|
44
|
-
Each key is namespaced under `flipper/v1/feature/`
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
require 'active_support/cache'
|
48
|
-
require 'flipper/adapters/active_support_cache_store'
|
49
|
-
|
50
|
-
memory_adapter = Flipper::Adapters::Memory.new
|
51
|
-
cache = ActiveSupport::Cache::MemoryStore.new
|
52
|
-
adapter = Flipper::Adapters::ActiveSupportCacheStore.new(memory_adapter, cache)
|
53
|
-
flipper = Flipper.new(adapter)
|
54
|
-
|
55
|
-
# Register a few groups.
|
56
|
-
Flipper.register(:admins) { |thing| thing.admin? }
|
57
|
-
Flipper.register(:early_access) { |thing| thing.early_access? }
|
58
|
-
|
59
|
-
# Create a user class that has flipper_id instance method.
|
60
|
-
User = Struct.new(:flipper_id)
|
61
|
-
|
62
|
-
flipper[:stats].enable
|
63
|
-
flipper[:stats].enable_group :admins
|
64
|
-
flipper[:stats].enable_group :early_access
|
65
|
-
flipper[:stats].enable_actor User.new('25')
|
66
|
-
flipper[:stats].enable_actor User.new('90')
|
67
|
-
flipper[:stats].enable_actor User.new('180')
|
68
|
-
flipper[:stats].enable_percentage_of_time 15
|
69
|
-
flipper[:stats].enable_percentage_of_actors 45
|
70
|
-
flipper[:search].enable
|
71
|
-
|
72
|
-
# reading all feature keys
|
73
|
-
pp cache.read("flipper/v1/features")
|
74
|
-
#<Set: {"stats", "search"}>
|
75
|
-
|
76
|
-
# reading a single feature
|
77
|
-
pp cache.read("flipper/v1/feature/stats")
|
78
|
-
{
|
79
|
-
:boolean=>"true",
|
80
|
-
:groups=>#<Set: {"admins", "early_access"}>,
|
81
|
-
:actors=>#<Set: {"25", "90", "180"}>,
|
82
|
-
:percentage_of_actors=>"45",
|
83
|
-
:percentage_of_time=>"15"
|
84
|
-
}
|
85
|
-
|
86
|
-
# flipper get of feature
|
87
|
-
pp adapter.get(flipper[:stats])
|
88
|
-
{
|
89
|
-
:boolean=>"true",
|
90
|
-
:groups=>#<Set: {"admins", "early_access"}>,
|
91
|
-
:actors=>#<Set: {"25", "90", "180"}>,
|
92
|
-
:percentage_of_actors=>"45",
|
93
|
-
:percentage_of_time=>"15"
|
94
|
-
}
|
95
|
-
```
|
96
|
-
|
97
|
-
## Contributing
|
98
|
-
|
99
|
-
1. Fork it
|
100
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
101
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
102
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
103
|
-
5. Create new Pull Request
|