Sha256: 7da3957b9699290c8a87d8023bfdcbcb6b10e24264ef93724ca912cb46e5c26d
Contents?: true
Size: 1.01 KB
Versions: 15
Compression:
Stored size: 1.01 KB
Contents
module Rhosync class ReadState < Model field :refresh_time, :integer field :prev_refresh_time, :integer field :retry_counter, :integer def self.create(fields) fields[:id] = get_id(fields) fields.delete(:app_id) fields.delete(:user_id) fields.delete(:source_name) fields[:refresh_time] ||= Time.now.to_i fields[:prev_refresh_time] ||= Time.now.to_i fields[:retry_counter] ||= 0 super(fields,{}) end def self.load(params) super(get_id(params),{}) end def self.delete(app_id) Store.flash_data("#{class_prefix(self)}:#{app_id}:*") end def self.delete_user(params) puts "#{class_prefix(self)}:#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}:*" Store.flash_data("#{class_prefix(self)}:#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}:*") end private def self.get_id(params) "#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}" end end end
Version data entries
15 entries across 15 versions & 1 rubygems