Class: ModelContextProtocol::Server::RedisClientProxy
- Inherits:
-
Object
- Object
- ModelContextProtocol::Server::RedisClientProxy
show all
- Defined in:
- lib/model_context_protocol/server/redis_client_proxy.rb
Defined Under Namespace
Classes: RedisMultiWrapper
Instance Method Summary
collapse
-
#del(*keys) ⇒ Object
-
#eval(script, keys: [], argv: []) ⇒ Object
-
#exists(*keys) ⇒ Object
-
#expire(key, seconds) ⇒ Object
-
#get(key) ⇒ Object
-
#hget(key, field) ⇒ Object
-
#hmget(key, *fields) ⇒ Object
-
#hset(key, *args) ⇒ Object
-
#incr(key) ⇒ Object
-
#initialize(pool) ⇒ RedisClientProxy
constructor
A new instance of RedisClientProxy.
-
#keys(pattern) ⇒ Object
-
#llen(key) ⇒ Object
-
#lpush(key, *values) ⇒ Object
-
#lrange(key, start, stop) ⇒ Object
-
#ltrim(key, start, stop) ⇒ Object
-
#mget(*keys) ⇒ Object
-
#multi(&block) ⇒ Object
-
#pipelined(&block) ⇒ Object
-
#rpop(key) ⇒ Object
-
#set(key, value, **options) ⇒ Object
-
#ttl(key) ⇒ Object
Constructor Details
Returns a new instance of RedisClientProxy.
6
7
8
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 6
def initialize(pool)
@pool = pool
end
|
Instance Method Details
#del(*keys) ⇒ Object
18
19
20
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 18
def del(*keys)
with_connection { |redis| redis.del(*keys) }
end
|
#eval(script, keys: [], argv: []) ⇒ Object
96
97
98
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 96
def eval(script, keys: [], argv: [])
with_connection { |redis| redis.eval(script, keys: keys, argv: argv) }
end
|
#exists(*keys) ⇒ Object
22
23
24
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 22
def exists(*keys)
with_connection { |redis| redis.exists(*keys) }
end
|
#expire(key, seconds) ⇒ Object
26
27
28
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 26
def expire(key, seconds)
with_connection { |redis| redis.expire(key, seconds) }
end
|
#get(key) ⇒ Object
10
11
12
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 10
def get(key)
with_connection { |redis| redis.get(key) }
end
|
#hget(key, field) ⇒ Object
34
35
36
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 34
def hget(key, field)
with_connection { |redis| redis.hget(key, field) }
end
|
#hmget(key, *fields) ⇒ Object
42
43
44
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 42
def hmget(key, *fields)
with_connection { |redis| redis.hmget(key, *fields) }
end
|
#hset(key, *args) ⇒ Object
38
39
40
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 38
def hset(key, *args)
with_connection { |redis| redis.hset(key, *args) }
end
|
#incr(key) ⇒ Object
66
67
68
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 66
def incr(key)
with_connection { |redis| redis.incr(key) }
end
|
#keys(pattern) ⇒ Object
70
71
72
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 70
def keys(pattern)
with_connection { |redis| redis.keys(pattern) }
end
|
#llen(key) ⇒ Object
58
59
60
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 58
def llen(key)
with_connection { |redis| redis.llen(key) }
end
|
#lpush(key, *values) ⇒ Object
46
47
48
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 46
def lpush(key, *values)
with_connection { |redis| redis.lpush(key, *values) }
end
|
#lrange(key, start, stop) ⇒ Object
54
55
56
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 54
def lrange(key, start, stop)
with_connection { |redis| redis.lrange(key, start, stop) }
end
|
#ltrim(key, start, stop) ⇒ Object
62
63
64
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 62
def ltrim(key, start, stop)
with_connection { |redis| redis.ltrim(key, start, stop) }
end
|
#mget(*keys) ⇒ Object
92
93
94
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 92
def mget(*keys)
with_connection { |redis| redis.mget(*keys) }
end
|
#multi(&block) ⇒ Object
74
75
76
77
78
79
80
81
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 74
def multi(&block)
with_connection do |redis|
redis.multi do |multi|
multi_wrapper = RedisMultiWrapper.new(multi)
block.call(multi_wrapper)
end
end
end
|
#pipelined(&block) ⇒ Object
83
84
85
86
87
88
89
90
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 83
def pipelined(&block)
with_connection do |redis|
redis.pipelined do |pipeline|
pipeline_wrapper = RedisMultiWrapper.new(pipeline)
block.call(pipeline_wrapper)
end
end
end
|
#rpop(key) ⇒ Object
50
51
52
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 50
def rpop(key)
with_connection { |redis| redis.rpop(key) }
end
|
#set(key, value, **options) ⇒ Object
14
15
16
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 14
def set(key, value, **options)
with_connection { |redis| redis.set(key, value, **options) }
end
|
#ttl(key) ⇒ Object
30
31
32
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 30
def ttl(key)
with_connection { |redis| redis.ttl(key) }
end
|