Method: AsyncStorage::Allocator#fresh?

Defined in:
lib/async_storage/allocator.rb

#fresh?Boolean

Check if a fresh object exists into the storage

Returns:

  • (Boolean)

    true/false according to the object existence and freshness



139
140
141
142
143
# File 'lib/async_storage/allocator.rb', line 139

def fresh?
  breaker.run(fallback: -> { false }) do
    connection { |redis| redis.exists?(naming.body) && redis.ttl(naming.head) > 0 }
  end
end