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
-
#decr(key) ⇒ Object
-
#del(*keys) ⇒ Object
-
#eval(script, keys: [], argv: []) ⇒ Object
-
#exists(*keys) ⇒ Object
-
#expire(key, seconds) ⇒ Object
-
#flushdb ⇒ Object
-
#get(key) ⇒ Object
-
#hget(key, field) ⇒ Object
-
#hgetall(key) ⇒ 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
-
#ping ⇒ 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
#decr(key) ⇒ Object
70
71
72
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 70
def decr(key)
with_connection { |redis| redis.decr(key) }
end
|
#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
100
101
102
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 100
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
|
#flushdb ⇒ Object
108
109
110
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 108
def flushdb
with_connection { |redis| redis.flushdb }
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
|
#hgetall(key) ⇒ Object
42
43
44
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 42
def hgetall(key)
with_connection { |redis| redis.hgetall(key) }
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
74
75
76
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 74
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
96
97
98
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 96
def mget(*keys)
with_connection { |redis| redis.mget(*keys) }
end
|
#multi(&block) ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 78
def multi(&block)
with_connection do |redis|
redis.multi do |multi|
multi_wrapper = RedisMultiWrapper.new(multi)
block.call(multi_wrapper)
end
end
end
|
#ping ⇒ Object
104
105
106
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 104
def ping
with_connection { |redis| redis.ping }
end
|
#pipelined(&block) ⇒ Object
87
88
89
90
91
92
93
94
|
# File 'lib/model_context_protocol/server/redis_client_proxy.rb', line 87
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
|