KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
redis_pool
★ 21
Open GitHub ↗
Redis pool for Elixir lang
Download README (.md)
Explore Similar Repositories
AnimationManager
:
Animation Manager for XAML
ros-testing-tutorial
:
ROS files and exercises for the ros-tdd seminar I gave to the Social Robots Group on march 2014
diy-dogecoin-digger
:
Do-It-Yourself Dogecoin Digger (DDD): Start digging in your own back yard!
purescript-refs
:
Mutable value references
ExpandSync
:
A simple engine to sync aText and TextExpander iOS
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
redis_pool
?
Download (.md)
# RedisPool for Elixir [](https://travis-ci.org/le0pard/redis_pool) This is redis pool for [Elixir](http://elixir-lang.org/). Build on top of [eredis](https://github.com/wooga/eredis) and [poolboy](https://github.com/devinus/poolboy). ## Examples Application start: ``` RedisPool.start ``` or add it in `application` section in mix: ``` def application do [mod: {Example, []}, applications: [ :redis_pool ] ] end ``` ### Create pools ``` RedisPool.create_pool(:default, 10) RedisPool.create_pool(:test, 10, 'localhost', 6379) RedisPool.create_pool(:test2, 10, 'localhost', 6379, 0, 'password', 100) ``` Also you can configure redis_pool directly from configuration file to get pools automatically created at application startup. In `config/config.exs`, add : ``` config :redis_pool, :pools, [ test_pool: [size: 10], test_pool_2: [size: 10, database: 111], test_pool_3: [size: 20, host: '127.0.0.1', port: 6379, database: 'user_db', password: 'abc', reconnect_sleep: '20'] ] ``` ### Delete pools ``` RedisPool.delete_pool(:default) RedisPool.delete_pool(:test) ``` ### Usage Usage of pools: ``` RedisPool.q({:global, :default}, ["SET", "foo", "bar"]) RedisPool.q({:global, :test}, ["GET", "foo"]) ``` Method `transaction` is execute all redis command between `MULTI` and `EXEC` commands: ``` RedisPool.transaction {:global, :redis}, fn(redis) -> :eredis.q redis, ["SADD", "queues", queue] :eredis.q redis, ["LPUSH", "queue", "Test" ] end ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request