2021-11-18 22:05:49 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
|
|
module MergeRequests
|
|
|
|
module Mergeability
|
|
|
|
class RedisInterface
|
|
|
|
EXPIRATION = 6.hours
|
|
|
|
VERSION = 1
|
|
|
|
|
|
|
|
def save_check(merge_check:, result_hash:)
|
2022-01-26 12:08:38 +05:30
|
|
|
Gitlab::Redis::Cache.with do |redis|
|
2021-11-18 22:05:49 +05:30
|
|
|
redis.set(merge_check.cache_key + ":#{VERSION}", result_hash.to_json, ex: EXPIRATION)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def retrieve_check(merge_check:)
|
2022-01-26 12:08:38 +05:30
|
|
|
Gitlab::Redis::Cache.with do |redis|
|
2021-11-18 22:05:49 +05:30
|
|
|
Gitlab::Json.parse(redis.get(merge_check.cache_key + ":#{VERSION}"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|