Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An interface to Redis that mimic's Ruby's IO classes
branch: master

This branch is 3 commits behind quirkey:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
spec
.document
.gitignore
HISTORY
LICENSE
README.rdoc
Rakefile
redisk.gemspec

README.rdoc

redisk

An interface to Redis that mimic's Ruby's IO classes

WHAT

Redis (code.google.com/p/redis/) is a super awesome persisted key-value store.

Why are we still logging to files then?

Redisk is a set of Ruby classes that mimic's Ruby's built in IO classes to allow drop in replacement for logging and other fun things.

USAGE

Currently, Redisk provides two main classes Redisk::IO and Redisk::Logger.

Redisk::IO implements most of the methods of Ruby's IO class (ruby-doc.org/core/classes/IO.html)

require 'redisk'

io = Redisk::IO.new('mylog.log') # not a file, a Redis List
io.puts "Log this!"
io.gets #=> "Log this!"
io.gets #=> nil
io.lineno = 2

Its much more interesting to use it with logger.

logger = Logger.new(Redisk::IO.new('test.log))
logger.info("Hahah, I'm logging to redis")
logger.warn("whu?")
logger.error("zuh")

Theres also a nifty wrapper for that behavior:

logger = Redisk::Logger.new('test.log')
logger.info "10 less characters!"

By default, Redisk uses the Redis on localhost:6379, but you can change that by setting

Redisk.redis = 'myhost:myport'

Check out the small but growing list of examples in examples/

INSTALL (NOW!)

Proudly tested and working on Ruby 1.8.6, 1.8.7, and 1.9.1

Gems are on gemcutter:

gem install redisk

Dependencies:

redis running somewhere

gems:
  redis
  redis-namespace

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2009 Aaron Quint. See LICENSE for details.

Something went wrong with that request. Please try again.