dynamo-store 0.0.1 → 1.0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yaml +42 -0
- data/.gitignore +2 -0
- data/Appraisals +0 -8
- data/CONTRIBUTING.md +6 -0
- data/Changelog.md +21 -0
- data/Gemfile.lock +74 -761
- data/README.md +48 -11
- data/dynamo-store.gemspec +5 -4
- data/gemfiles/active_support_5.1.gemfile.lock +29 -721
- data/gemfiles/active_support_5.2.gemfile.lock +29 -721
- data/gemfiles/aws_sdk_3.gemfile.lock +32 -722
- data/lib/active_support/cache/dynamo_store.rb +9 -5
- data/lib/dynamo-store/version.rb +1 -1
- data/lib/dynamo-store.rb +1 -0
- metadata +35 -25
- data/.circleci/config.yml +0 -76
- data/.travis.yml +0 -7
- data/gemfiles/active_support_5.0.gemfile +0 -7
- data/gemfiles/active_support_5.0.gemfile.lock +0 -809
- data/gemfiles/aws_sdk_2.gemfile +0 -7
- data/gemfiles/aws_sdk_2.gemfile.lock +0 -113
data/README.md
CHANGED
@@ -1,23 +1,60 @@
|
|
1
|
-
#
|
1
|
+
# DynamoDB Adapter for [ActiveSupport Cache](https://github.com/rails/rails/tree/master/activesupport/lib/active_support/cache.rb)
|
2
2
|
|
3
|
+
## Installation
|
3
4
|
|
4
|
-
|
5
|
-
https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
|
6
|
-
|
7
|
-
## Install in Rails
|
5
|
+
Add this line to your application's Gemfile:
|
8
6
|
|
9
|
-
|
10
|
-
```ruby
|
7
|
+
```
|
11
8
|
gem 'dynamo-store'
|
12
9
|
```
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
require 'dynamo'
|
17
|
-
DynamoCache = ActiveSupport::Cache::Dynamo.new
|
11
|
+
And then execute:
|
12
|
+
|
18
13
|
```
|
14
|
+
bundle
|
15
|
+
```
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
```
|
20
|
+
gem install dynamo-store
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
DynamoStore provides an adapter layer ActiveSupport::Cache to DynamoDB. A
|
26
|
+
serverless key-value store offering millisecond recall and write time.
|
27
|
+
|
28
|
+
DynamoStore leverages to the DynamoDB TTL column to automatically remove items
|
29
|
+
as they reach expiration time, this feature should be enabled, as this adapter
|
30
|
+
does not implement any manual cleanup steps.
|
31
|
+
|
32
|
+
### Configuration
|
33
|
+
All configuration options are passed during construction of the store. You may
|
34
|
+
also provide the arguments given to the superclass
|
35
|
+
[ActiveSupport::Cache::Store](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-c-new).
|
36
|
+
|
37
|
+
|
38
|
+
| Configuration | Type | Default | Description
|
39
|
+
| --------------- | ------------------- | ---------------- | ------------
|
40
|
+
| table_name | string | None. Required | The name of the DynamoDB Table
|
41
|
+
| dynamo_client | Aws:::DynamoDB::Client | Default AWS SDK Client | The client to use for connections. Useful for directing the cache at a local installation
|
42
|
+
| hash_key | string | 'CacheKey' | The name of the hash key for the cache table
|
43
|
+
| ttl_key | string | 'TTL' | The colum to use for auto-ttling items
|
19
44
|
|
20
45
|
|
46
|
+
### Rails
|
21
47
|
|
48
|
+
```ruby
|
49
|
+
# in config/application.rb
|
50
|
+
|
51
|
+
config.cache_store = :dynamo_store, {table_name: 'AppCache'}
|
52
|
+
```
|
22
53
|
|
54
|
+
### Outside of Rails
|
23
55
|
|
56
|
+
```ruby
|
57
|
+
require 'dynamo-store'
|
58
|
+
|
59
|
+
cache = ActiveSupport::Cache::DynamoStore.new(table_name: 'AppCache')
|
60
|
+
```
|
data/dynamo-store.gemspec
CHANGED
@@ -39,14 +39,15 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.require_paths = ['lib']
|
40
40
|
|
41
41
|
spec.add_dependency 'activesupport', '> 5.0'
|
42
|
-
spec.add_dependency 'aws-sdk', '>
|
42
|
+
spec.add_dependency 'aws-sdk-dynamodb', '> 1.0'
|
43
|
+
spec.add_dependency 'rexml'
|
43
44
|
|
44
45
|
spec.add_development_dependency 'appraisal'
|
45
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
46
46
|
spec.add_development_dependency 'deep-cover'
|
47
|
-
spec.add_development_dependency 'rake', '~>
|
47
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
48
48
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
49
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
49
50
|
spec.add_development_dependency 'simplecov'
|
51
|
+
spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
|
50
52
|
spec.add_development_dependency 'timecop'
|
51
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
52
53
|
end
|