Module: RedisHash::Expiration

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/redis_hash/concerns/expiration.rb

Instance Method Summary collapse

Instance Method Details

#empty_before_insertion?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/redis_hash/concerns/expiration.rb', line 25

def empty_before_insertion?
  @was_empty_before_insertion.present?
end

#expire(seconds) ⇒ Object



29
30
31
# File 'lib/redis_hash/concerns/expiration.rb', line 29

def expire(seconds)
  redis.expire(redis_key, seconds)
end

#persistObject



37
38
39
40
# File 'lib/redis_hash/concerns/expiration.rb', line 37

def persist
  @redis_ttl = nil
  redis.persist(redis_key)
end

#ttlObject



33
34
35
# File 'lib/redis_hash/concerns/expiration.rb', line 33

def ttl
  redis.ttl(redis_key)
end