flipper-active_support_cache_store 0.22.0 → 0.23.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8c57c8671bae24416758d70e39c621f830924069e8f04659ad6ebf0ac56a1a8
|
4
|
+
data.tar.gz: 18cdd159b94f4ef6d4d9683e463436c85440d1dce2c19c3057c97f307111fab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1202f93303ce4deaf2e1dab3672968d142092e79b6172c9501e05a5b2a5cec3fd6152c989cb4223cdbcdb9763b7c37cf7d4ffc66c3f28830f14c528b877ff168
|
7
|
+
data.tar.gz: 8e410b26f8befcf2a9ea77533b76989ba025cfc51469562462f22d75cd4b9d3ede80e820dcb076c88ba7644f19e9ec387d0c9c62cebe582d4dfd285c26cf1081
|
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.23.1
|
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-01-19 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.1
|
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.1
|
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
|