flipper-active_support_cache_store 0.21.0 → 0.25.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: 9764a18fa36b221baa5575ffe59a85598be3489bb081553bae635c482b826158
|
4
|
+
data.tar.gz: 887af0700e3480fda483c06978d40b802f4a463cb3da521b593c81cd0da8aa7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a7b5b9f7fba685b247d14468177cbc97dcc886d915ac79b69dd381b0245f273190e73071a0480cd6ac29b0d074c7e6d3c3b41861c01759b8483a8c5c8340e16
|
7
|
+
data.tar.gz: 4403a0caa7361ee3d9d07535f285d825a7e99281c727789dae5d652a6ec32998febc212f5b109ca0cbd65267f8eeb7861b02e85842afbaa2295b90b2e9c668e3
|
data/lib/flipper/version.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'helper'
|
2
1
|
require 'active_support/cache'
|
3
|
-
require 'active_support/cache/dalli_store'
|
4
2
|
require 'flipper/adapters/operation_logger'
|
5
3
|
require 'flipper/adapters/active_support_cache_store'
|
6
|
-
require 'flipper/spec/shared_adapter_specs'
|
7
4
|
|
8
5
|
RSpec.describe Flipper::Adapters::ActiveSupportCacheStore do
|
9
6
|
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.25.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:
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,34 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.25.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.25.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
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
|