No commit activity in last 3 years
No release in over 3 years
Maintains period fields on any counter column in your database
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

= 0.2.7
 Project Readme

PeriodicCounter

Maintains period fields on any counter column in your database

Requirements

sudo gem install periodic_counter

Create columns

You should already have a counter column (let's call it X) that is being incremented by some external process.

Add an X_data varchar column with a length of 2048.

Add your periodic counters (all integers):

  • X_last_week
  • X_last_6_hours
  • X_last_sunday
  • X_2_days_ago

Currently only days of the week and ActiveSupport's time extensions are supported for time periods. If no digit is present, "1" is assumed.

Create configuration

Create a file, config/counters.yml:

my_table_name:
  - my_counter

The plugin assumes that the config directory also houses your database.yml file.

Create cron entry

Add the following command to your crontab at a period of your choosing:

cd /path/to/your/app && RAILS_ENV=production periodic_counter