Feature - reactive interface for RListMultimapCache & RSetMultimapCache objects. #3885
parent
841c9353ab
commit
fdcb943828
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2013-2021 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
/**
|
||||
* Reactive interface for {@link RListMultimapCache} object.
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> key type
|
||||
* @param <V> value type
|
||||
*/
|
||||
public interface RListMultimapCacheReactive<K, V> extends RListMultimapReactive<K, V>, RMultimapCacheReactive<K, V> {
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2013-2021 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
import io.reactivex.rxjava3.core.Single;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Reactive interface of {@link RMultimapCache} object.
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> key type
|
||||
* @param <V> value type
|
||||
*/
|
||||
public interface RMultimapCacheReactive<K, V> {
|
||||
|
||||
/**
|
||||
* Set a timeout for key. After the timeout has expired, the key and its values will automatically be deleted.
|
||||
*
|
||||
* @param key - map key
|
||||
* @param timeToLive - timeout before key will be deleted
|
||||
* @param timeUnit - timeout time unit
|
||||
* @return A Single that will emit <code>true</code> if key exists and the timeout was set and <code>false</code>
|
||||
* if key not exists
|
||||
*/
|
||||
Single<Boolean> expireKey(K key, long timeToLive, TimeUnit timeUnit);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2013-2021 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
/**
|
||||
* Reactive interface for {@link RSetMultimapCache} object.
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> key type
|
||||
* @param <V> value type
|
||||
*/
|
||||
public interface RSetMultimapCacheReactive<K, V> extends RSetMultimapReactive<K, V>, RMultimapCacheReactive<K, V> {
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright (c) 2013-2021 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.reactive;
|
||||
|
||||
import org.redisson.RedissonList;
|
||||
import org.redisson.RedissonListMultimapCache;
|
||||
import org.redisson.api.RListReactive;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> key type
|
||||
* @param <V> value type
|
||||
*/
|
||||
public class RedissonListMultimapCacheReactive<K, V> {
|
||||
|
||||
private final RedissonListMultimapCache<K, V> instance;
|
||||
private final CommandReactiveExecutor commandExecutor;
|
||||
|
||||
public RedissonListMultimapCacheReactive(RedissonListMultimapCache<K, V> instance, CommandReactiveExecutor commandExecutor) {
|
||||
this.instance = instance;
|
||||
this.commandExecutor = commandExecutor;
|
||||
}
|
||||
|
||||
public RListReactive<V> get(K key) {
|
||||
RedissonList<V> list = (RedissonList<V>) instance.get(key);
|
||||
return ReactiveProxyBuilder.create(commandExecutor, list, new RedissonListReactive<>(list), RListReactive.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2013-2021 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.reactive;
|
||||
|
||||
import org.redisson.RedissonSet;
|
||||
import org.redisson.RedissonSetMultimapCache;
|
||||
import org.redisson.api.RSetReactive;
|
||||
import org.redisson.api.RedissonReactiveClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> key type
|
||||
* @param <V> value type
|
||||
*/
|
||||
public class RedissonSetMultimapCacheReactive<K, V> {
|
||||
|
||||
private final RedissonSetMultimapCache<K, V> instance;
|
||||
private final CommandReactiveExecutor commandExecutor;
|
||||
private final RedissonReactiveClient redisson;
|
||||
|
||||
public RedissonSetMultimapCacheReactive(RedissonSetMultimapCache<K, V> instance, CommandReactiveExecutor commandExecutor,
|
||||
RedissonReactiveClient redisson) {
|
||||
this.instance = instance;
|
||||
this.redisson = redisson;
|
||||
this.commandExecutor = commandExecutor;
|
||||
}
|
||||
|
||||
public RSetReactive<V> get(K key) {
|
||||
RedissonSet<V> set = (RedissonSet<V>) instance.get(key);
|
||||
return ReactiveProxyBuilder.create(commandExecutor, set, new RedissonSetReactive<>(set, redisson), RSetReactive.class);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue