cartodb-4.42/services/data-repository/backend/redis/string.rb
2024-04-06 05:25:13 +00:00

28 lines
479 B
Ruby

require 'json'
require 'redis'
module DataRepository
module Backend
class Redis
class String
def initialize(redis=Redis.new)
@redis = redis
end #initialize
def store(key, data)
redis.set key, data.to_json
end #store
def fetch(key)
JSON.parse redis.get(key)
end #fetch
private
attr_reader :redis
end # String
end # Redis
end # Backend
end # DataRepository