flipper-active_support_cache_store 0.22.1 → 0.24.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: d949e7044c678732010640591da4a6b320162fc138e4df13d4955ff2fc20fd0a
|
4
|
+
data.tar.gz: 7910409ba9e0a8f80a607911111a2e4e6e9343e061dd2d837198a22e0f6dd106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40c14b1a6e61baa7ff1f5caebba64d08f70a954784d6b9081c3644670f273625acddc747a7e268ff0cee37275ecd9fc46719a78b236dda9b0d98d03a4fc214cc
|
7
|
+
data.tar.gz: bf41999993b1c8eb8bc9d6a5c9c24d441a59064672dfaefa3c75309dfe8bb1761228a267bd72233c391207e117fda878d09fbc624a8010fc9aa4a5d17a301e40
|
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.24.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-02-17 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.24.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.24.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
|