@@ -8,7 +8,14 @@ internal partial class RespContextDatabase
88 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
99 private KeyCommands Keys ( CommandFlags flags ) => Context ( flags ) . Keys ( ) ;
1010
11- // Async Key methods
11+ public bool KeyCopy (
12+ RedisKey sourceKey ,
13+ RedisKey destinationKey ,
14+ int destinationDatabase = - 1 ,
15+ bool replace = false ,
16+ CommandFlags flags = CommandFlags . None ) =>
17+ Keys ( flags ) . Copy ( sourceKey , destinationKey , destinationDatabase , replace ) . Wait ( SyncTimeout ) ;
18+
1219 public Task < bool > KeyCopyAsync (
1320 RedisKey sourceKey ,
1421 RedisKey destinationKey ,
@@ -17,21 +24,62 @@ public Task<bool> KeyCopyAsync(
1724 CommandFlags flags = CommandFlags . None )
1825 => Keys ( flags ) . Copy ( sourceKey , destinationKey , destinationDatabase , replace ) . AsTask ( ) ;
1926
27+ public bool KeyDelete ( RedisKey key , CommandFlags flags = CommandFlags . None )
28+ => Keys ( flags ) . Del ( key ) . Wait ( SyncTimeout ) ;
29+
30+ public long KeyDelete ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None ) =>
31+ Keys ( flags ) . Del ( keys ) . Wait ( SyncTimeout ) ;
32+
33+ public Task < bool > KeyDeleteAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
34+ => Keys ( flags ) . Del ( key ) . AsTask ( ) ;
35+
2036 public Task < long > KeyDeleteAsync ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
2137 => Keys ( flags ) . Del ( keys ) . AsTask ( ) ;
2238
39+ public byte [ ] ? KeyDump ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
40+ Keys ( flags ) . Dump ( key ) . Wait ( SyncTimeout ) ;
41+
2342 public Task < byte [ ] ? > KeyDumpAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
2443 => Keys ( flags ) . Dump ( key ) . AsTask ( ) ;
2544
45+ public string ? KeyEncoding ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
46+ Keys ( flags ) . ObjectEncoding ( key ) . Wait ( SyncTimeout ) ;
47+
2648 public Task < string ? > KeyEncodingAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
2749 => Keys ( flags ) . ObjectEncoding ( key ) . AsTask ( ) ;
2850
51+ public bool KeyExists ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
52+ Keys ( flags ) . Exists ( key ) . Wait ( SyncTimeout ) ;
53+
54+ public long KeyExists ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None ) =>
55+ Keys ( flags ) . Exists ( keys ) . Wait ( SyncTimeout ) ;
56+
2957 public Task < bool > KeyExistsAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
3058 => Keys ( flags ) . Exists ( key ) . AsTask ( ) ;
3159
3260 public Task < long > KeyExistsAsync ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
3361 => Keys ( flags ) . Exists ( keys ) . AsTask ( ) ;
3462
63+ public bool KeyExpire ( RedisKey key , TimeSpan ? expiry , CommandFlags flags ) =>
64+ Keys ( flags ) . Expire ( key , expiry ) . Wait ( SyncTimeout ) ;
65+
66+ public bool KeyExpire (
67+ RedisKey key ,
68+ TimeSpan ? expiry ,
69+ ExpireWhen when = ExpireWhen . Always ,
70+ CommandFlags flags = CommandFlags . None ) =>
71+ Keys ( flags ) . Expire ( key , expiry , when ) . Wait ( SyncTimeout ) ;
72+
73+ public bool KeyExpire ( RedisKey key , DateTime ? expiry , CommandFlags flags ) =>
74+ Keys ( flags ) . ExpireAt ( key , expiry ) . Wait ( SyncTimeout ) ;
75+
76+ public bool KeyExpire (
77+ RedisKey key ,
78+ DateTime ? expiry ,
79+ ExpireWhen when = ExpireWhen . Always ,
80+ CommandFlags flags = CommandFlags . None ) =>
81+ Keys ( flags ) . ExpireAt ( key , expiry , when ) . Wait ( SyncTimeout ) ;
82+
3583 public Task < bool > KeyExpireAsync ( RedisKey key , TimeSpan ? expiry , CommandFlags flags )
3684 => Keys ( flags ) . Expire ( key , expiry ) . AsTask ( ) ;
3785
@@ -52,144 +100,97 @@ public Task<bool> KeyExpireAsync(
52100 CommandFlags flags = CommandFlags . None )
53101 => Keys ( flags ) . ExpireAt ( key , expiry , when ) . AsTask ( ) ;
54102
103+ public DateTime ? KeyExpireTime ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
104+ Keys ( flags ) . PExpireTime ( key ) . Wait ( SyncTimeout ) ;
105+
55106 public Task < DateTime ? > KeyExpireTimeAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
56107 => Keys ( flags ) . PExpireTime ( key ) . AsTask ( ) ;
57108
109+ public long ? KeyFrequency ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
110+ Keys ( flags ) . ObjectFreq ( key ) . Wait ( SyncTimeout ) ;
111+
58112 public Task < long ? > KeyFrequencyAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
59113 => Keys ( flags ) . ObjectFreq ( key ) . AsTask ( ) ;
60114
115+ public TimeSpan ? KeyIdleTime ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
116+ Keys ( flags ) . ObjectIdleTime ( key ) . Wait ( SyncTimeout ) ;
117+
61118 public Task < TimeSpan ? > KeyIdleTimeAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
62119 => Keys ( flags ) . ObjectIdleTime ( key ) . AsTask ( ) ;
63120
121+ public bool KeyMove ( RedisKey key , int database , CommandFlags flags = CommandFlags . None ) =>
122+ Keys ( flags ) . Move ( key , database ) . Wait ( SyncTimeout ) ;
123+
64124 public Task < bool > KeyMoveAsync ( RedisKey key , int database , CommandFlags flags = CommandFlags . None )
65125 => Keys ( flags ) . Move ( key , database ) . AsTask ( ) ;
66126
127+ public bool KeyPersist ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
128+ Keys ( flags ) . Persist ( key ) . Wait ( SyncTimeout ) ;
129+
67130 public Task < bool > KeyPersistAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
68131 => Keys ( flags ) . Persist ( key ) . AsTask ( ) ;
69132
133+ public RedisKey KeyRandom ( CommandFlags flags = CommandFlags . None ) =>
134+ Keys ( flags ) . RandomKey ( ) . Wait ( SyncTimeout ) ;
135+
70136 public Task < RedisKey > KeyRandomAsync ( CommandFlags flags = CommandFlags . None )
71137 => Keys ( flags ) . RandomKey ( ) . AsTask ( ) ;
72138
139+ public long ? KeyRefCount ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
140+ Keys ( flags ) . ObjectRefCount ( key ) . Wait ( SyncTimeout ) ;
141+
73142 public Task < long ? > KeyRefCountAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
74143 => Keys ( flags ) . ObjectRefCount ( key ) . AsTask ( ) ;
75144
145+ public bool KeyRename (
146+ RedisKey key ,
147+ RedisKey newKey ,
148+ When when = When . Always ,
149+ CommandFlags flags = CommandFlags . None ) =>
150+ Keys ( flags ) . Rename ( key , newKey , when ) . Wait ( SyncTimeout ) ;
151+
76152 public Task < bool > KeyRenameAsync (
77153 RedisKey key ,
78154 RedisKey newKey ,
79155 When when = When . Always ,
80156 CommandFlags flags = CommandFlags . None )
81157 => Keys ( flags ) . Rename ( key , newKey , when ) . AsTask ( ) ;
82158
159+ public void KeyRestore (
160+ RedisKey key ,
161+ byte [ ] value ,
162+ TimeSpan ? expiry = null ,
163+ CommandFlags flags = CommandFlags . None ) =>
164+ Keys ( flags ) . Restore ( key , expiry , value ) . Wait ( SyncTimeout ) ;
165+
83166 public Task KeyRestoreAsync (
84167 RedisKey key ,
85168 byte [ ] value ,
86169 TimeSpan ? expiry = null ,
87170 CommandFlags flags = CommandFlags . None )
88171 => Keys ( flags ) . Restore ( key , expiry , value ) . AsTask ( ) ;
89172
173+ public TimeSpan ? KeyTimeToLive ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
174+ Keys ( flags ) . Pttl ( key ) . Wait ( SyncTimeout ) ;
175+
90176 public Task < TimeSpan ? > KeyTimeToLiveAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
91177 => Keys ( flags ) . Pttl ( key ) . AsTask ( ) ;
92178
179+ public bool KeyTouch ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
180+ Keys ( flags ) . Touch ( key ) . Wait ( SyncTimeout ) ;
181+
182+ public long KeyTouch ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None ) =>
183+ Keys ( flags ) . Touch ( keys ) . Wait ( SyncTimeout ) ;
184+
93185 public Task < bool > KeyTouchAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
94186 => Keys ( flags ) . Touch ( key ) . AsTask ( ) ;
95187
96188 public Task < long > KeyTouchAsync ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
97189 => Keys ( flags ) . Touch ( keys ) . AsTask ( ) ;
98190
191+ public RedisType KeyType ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
192+ Keys ( flags ) . Type ( key ) . Wait ( SyncTimeout ) ;
193+
99194 public Task < RedisType > KeyTypeAsync ( RedisKey key , CommandFlags flags = CommandFlags . None )
100195 => Keys ( flags ) . Type ( key ) . AsTask ( ) ;
101-
102- // Synchronous Key methods
103- public bool KeyCopy (
104- RedisKey sourceKey ,
105- RedisKey destinationKey ,
106- int destinationDatabase = - 1 ,
107- bool replace = false ,
108- CommandFlags flags = CommandFlags . None ) =>
109- throw new NotImplementedException ( ) ;
110-
111- [ RespCommand ( "del" ) ]
112- public partial bool KeyDelete ( RedisKey key , CommandFlags flags = CommandFlags . None ) ;
113-
114- public long KeyDelete ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None ) =>
115- throw new NotImplementedException ( ) ;
116-
117- public byte [ ] ? KeyDump ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
118- throw new NotImplementedException ( ) ;
119-
120- public string ? KeyEncoding ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
121- throw new NotImplementedException ( ) ;
122-
123- public bool KeyExists ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
124- throw new NotImplementedException ( ) ;
125-
126- public long KeyExists ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None ) =>
127- throw new NotImplementedException ( ) ;
128-
129- public bool KeyExpire ( RedisKey key , TimeSpan ? expiry , CommandFlags flags ) =>
130- throw new NotImplementedException ( ) ;
131-
132- public bool KeyExpire (
133- RedisKey key ,
134- TimeSpan ? expiry ,
135- ExpireWhen when = ExpireWhen . Always ,
136- CommandFlags flags = CommandFlags . None ) =>
137- throw new NotImplementedException ( ) ;
138-
139- public bool KeyExpire ( RedisKey key , DateTime ? expiry , CommandFlags flags ) =>
140- throw new NotImplementedException ( ) ;
141-
142- public bool KeyExpire (
143- RedisKey key ,
144- DateTime ? expiry ,
145- ExpireWhen when = ExpireWhen . Always ,
146- CommandFlags flags = CommandFlags . None ) =>
147- throw new NotImplementedException ( ) ;
148-
149- public DateTime ? KeyExpireTime ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
150- throw new NotImplementedException ( ) ;
151-
152- public long ? KeyFrequency ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
153- throw new NotImplementedException ( ) ;
154-
155- public TimeSpan ? KeyIdleTime ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
156- throw new NotImplementedException ( ) ;
157-
158- public bool KeyMove ( RedisKey key , int database , CommandFlags flags = CommandFlags . None ) =>
159- throw new NotImplementedException ( ) ;
160-
161- public bool KeyPersist ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
162- throw new NotImplementedException ( ) ;
163-
164- public RedisKey KeyRandom ( CommandFlags flags = CommandFlags . None ) =>
165- throw new NotImplementedException ( ) ;
166-
167- public long ? KeyRefCount ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
168- throw new NotImplementedException ( ) ;
169-
170- public bool KeyRename (
171- RedisKey key ,
172- RedisKey newKey ,
173- When when = When . Always ,
174- CommandFlags flags = CommandFlags . None ) =>
175- throw new NotImplementedException ( ) ;
176-
177- public void KeyRestore (
178- RedisKey key ,
179- byte [ ] value ,
180- TimeSpan ? expiry = null ,
181- CommandFlags flags = CommandFlags . None ) =>
182- throw new NotImplementedException ( ) ;
183-
184- public TimeSpan ? KeyTimeToLive ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
185- throw new NotImplementedException ( ) ;
186-
187- public bool KeyTouch ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
188- throw new NotImplementedException ( ) ;
189-
190- public long KeyTouch ( RedisKey [ ] keys , CommandFlags flags = CommandFlags . None ) =>
191- throw new NotImplementedException ( ) ;
192-
193- public RedisType KeyType ( RedisKey key , CommandFlags flags = CommandFlags . None ) =>
194- throw new NotImplementedException ( ) ;
195196}
0 commit comments