Socket
Book a DemoInstallSign in
Socket

redis_field

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis_field

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

RedisField Build Status Code Climate

RedisField is a simple Ruby gem that stores model-specific data to Redis just like normal ActiveRecord attributes.

Great for caches, API responses etc.

Installation

You will need ActiveRecord 3.2+ (oops, gotta test it).

Add this line to your application's Gemfile:

  gem 'redis_field', github: 'konukhov/redis_field'

And then execute:

$ bundle

Usage

1. Specify field names in your model

  class User < ActiveRecord::Base
    redis_field :some_data

    # redis_fields is just an alias to redis_field
    redis_fields :facebook_friend_ids, :last_logged_in
  end

2. Use these fields just like normal AR attributes

  user = User.last
  user.some_data = "Testing redis_field"
  user.save
  user.reload.some_data # -> "Testing redis_field"
  user.update_attributes(last_logged_in: Time.now)
  user.reload.last_logged_in # -> 2014-04-05 01:00:00 +0000

NB This library is not an ORM for Redis, so it simply marshalls data before storing to Redis. There's no types coercion or anything like that.

More docs and features soon. :heart:

Testing

Just run

$ rake spec

See Appraisal for testing against different ActiveRecord versions.

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 04 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.