module WolfCore::InMemoryStorageDataSource
def acquire_lock(key:, value:, expiry:)
def acquire_lock(key:, value:, expiry:) instance.set("lock:process:#{ENV['TENANT']}:#{key}", value, ex: expiry.to_i, nx: true) end
def check_lock(key:)
def check_lock(key:) instance.get("lock:process:#{ENV['TENANT']}:#{key}") end
def init
def init @@redis = Redis.new(host: ENV['REDIS_ENDPOINT']) end
def instance
def instance @@redis end
def release_lock(key:)
def release_lock(key:) instance.del("lock:process:#{ENV['TENANT']}:#{key}") end
def set_non_exp_lock(key:, value:)
def set_non_exp_lock(key:, value:) instance.set("lock:process:#{ENV['TENANT']}:#{key}", value, nx: true) end