debian-mirror-gitlab/lib/gitlab/merge_requests/mergeability/redis_interface.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
614 B
Ruby
Raw Normal View History

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