0.0
No commit activity in last 3 years
No release in over 3 years
Super simple redis orm for learning purposes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.3
>= 0

Runtime

~> 3.0.0
 Project Readme

SsredisOrm

SsredisOrm it's just a very basic and simple redis orm, made for fun and learning purposes.

It doesn't support relationships but i hope it does one day. Feel free to contibute and i hope it helps someone :).

Installation

Add this line to your application's Gemfile:

gem 'ssredis_orm'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ssredis_orm

Usage

###Setting up redis rerver connection

You should initialize redis and set up a global $redis variable.

require 'redis'
$redis = Redis.new(:host => 'localhost', :port => 6379)

###Defining your model

Just create your model and extend SsredisOrm::Model.

class User
    extend SsredisOrm::Model
    field :name, :username, :password
end

Specify as many fields you wish to persist. Fields and the class itself will be serialized using de JSON library and persisted in redis under the key #{class.name}:#{@id}. Id's are auto-incremental, using redis atomic increment operations.

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