Module: RedisModelExtension::ClassAutoincrementId

Defined in:
lib/redis-model-extension/autoincrement_id.rb

Overview

Class Autoincrement Id

get last id generate autoincrement key

Instance Method Summary collapse

Instance Method Details

#generate_autoincrement_keyObject

generate autoincrement key



15
16
17
# File 'lib/redis-model-extension/autoincrement_id.rb', line 15

def generate_autoincrement_key
  "#{self.name.to_s.underscore.to_sym}:autoincrement_id"
end

#get_last_idObject

get last id from redis



10
11
12
# File 'lib/redis-model-extension/autoincrement_id.rb', line 10

def get_last_id
  Database.redis.get generate_autoincrement_key
end