No commit activity in last 3 years
No release in over 3 years
Counter cache function by Redis
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
>= 0
~> 10.0
>= 0

Runtime

 Project Readme

RedisCounterCache

Counter cache function by Redis

Installation

Add this line to your application's Gemfile:

gem 'redis_counter_cache'

And then execute:

$ bundle

Or install it yourself as:

$ gem install redis_counter_cache

Usage

# create_table :users do |t|
# end
class User < ActiveRecord::Base
  include Redis::Objects
  include RedisCounterCache

  has_many :user_items
  redis_counter_cache :user_items
end

# create_table :user_items do |t|
#   t.integer :user_id
# end
class UserItem < ActiveRecord::Base
  belongs_to :user
end

user = User.create
user.user_items.create
user.update_user_items_count_cache # specify updating cache when change
user.user_items_count # get count with a cache
# => 1

License

The gem is available as open source under the terms of the MIT License.