Sha256: 50b0461ddbae3e594316afbfdd3775b8aa63304ad032de81530bccf1d0728d48

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

# DynamoDB Adapter for [ActiveSupport Cache](https://github.com/rails/rails/tree/master/activesupport/lib/active_support/cache.rb)

## Installation

Add this line to your application's Gemfile:

```
gem 'dynamo-store'
```

And then execute:

```
bundle
```

Or install it yourself as:

```
gem install dynamo-store
```

## Usage

DynamoStore provides an adapter layer ActiveSupport::Cache to DynamoDB. A
serverless key-value store offering millisecond recall and write time.

DynamoStore leverages to the DynamoDB TTL column to automatically remove items
as they reach expiration time, this feature should be enabled, as this adapter
dose not impalement any manual cleanup steps.

### Configuration
All configuration options are passed during construction of the store. You may
also provide the arguments given to the superclass
[ActiveSupport::Cache::Store](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-c-new).


| Configuration   | Type                   | Default                | Description
| --------------- | -------------------    | ----------------       | ------------
| table_name      | string                 | None. Required         | The name of the DynamoDB Table
| dynamo_client   | Aws:::DynamoDB::Client | Default AWS SDK Client | The client to use for connections. Useful for directing the cache at a local installation
| hash_key        | string                 | 'CacheKey'             | The name of the hash key for the cache table
| ttl_key         | string                 | 'TTL'                  | The colum to use for auto-ttling items


### Rails

```ruby
# in config/application.rb

config.cache_store = :dynamo_store, {table_name: 'AppCache'}
```

### Outside of Rails

```ruby
require 'dynamo-store'

cache = ActiveSupport::Cache::Dynamo.new(table_name: 'AppCache')
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dynamo-store-1.0.0 README.md