A wrapper for the Dalli memcached client with support for AWS ElastiCache Auto Discovery
Install the rubygem:
# in your Gemfile
gem 'dalli-elasticache'
# in config/environments/production.rb
elasticache = Dalli::ElastiCache.new(config_endpoint)
config.cache_store = :dalli_store, elasticache.servers, {:expires_in => 1.day, :compress => true}
Note that the ElastiCache server list will be refreshed each time an app server process starts.
# Create an ElastiCache instance with your config endpoint and options for Dalli
elasticache = Dalli::ElastiCache.new(config_endpoint, dalli_options={})
# For example:
elasticache = Dalli::ElastiCache.new("aaron-scratch.vfdnac.cfg.use1.cache.amazonaws.com:11211", :expires_in => 3600, :namespace => "my_app")
elasticache.version # => the config version returned by the ElastiCache config endpoint.
elasticache.servers # => array of IP addresses and hostnames, e.g. ["10.84.227.115:11211", "10.77.71.127:11211"]
client = elasticache.client # a regular Dalli::Client using the instance IP addresses returns by the config endpoint
# Check the endpoint to see if the version has changed:
elasticache.refresh.version
# If so, update your dalli client:
client = elasticache.client
Copyright 2013 Aaron Suggs
Released under an MIT License
dalli-elasticache's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.