cartodb-4.42/lib/carto/dbdirect/metadata_manager.rb
2024-04-06 05:25:13 +00:00

27 lines
608 B
Ruby

module Carto
module Dbdirect
class MetadataManager
def initialize(config, metadata_server)
@config = config
@metadata = metadata_server
end
attr_reader :config
def save(key, ip_set = [])
@metadata.HSET(config['prefix_namespace'] + key, config['hash_key'], ip_set.join(','))
end
def get(key)
ip_set = @metadata.HGET(config['prefix_namespace'] + key, config['hash_key'])
ip_set.nil? ? [] : ip_set.split(',')
end
def reset(key)
@metadata.DEL(config['prefix_namespace'] + key)
end
end
end
end