Skip to content

Commit d8f2b3a

Browse files
authored
Merge pull request #237 from eclipse/redis-update
Redis update
2 parents 566a68d + 0693efa commit d8f2b3a

File tree

5 files changed

+96
-1
lines changed

5 files changed

+96
-1
lines changed

CHANGELOG.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
88

99
== [Unreleased]
1010

11+
=== Added
12+
13+
- Add BucketManagerFactory by injection to Redis
14+
15+
=== Changed
16+
17+
- Update Redis driver library to version 4.4.3
18+
1119
== [1.0.1] - 2023-7-31
1220

1321
=== Changed

README.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,30 @@ jnosql.keyvalue.provider=org.eclipse.jnosql.databases.redis.communication.RedisC
12831283
jnosql.keyvalue.database=heroes
12841284
----
12851285

1286+
=== RedisBucketManagerFactory
1287+
1288+
The ```RedisBucketManagerFactory``` is a specialization of the ```BucketManagerFactory``` that enables ranking and counter feature.
1289+
1290+
[source,java]
1291+
----
1292+
@Inject
1293+
RedisBucketManagerFactory factory;
1294+
...
1295+
SortedSet game = factory.getSortedSet("game");
1296+
game.add("Otavio", 10);
1297+
game.add("Luiz", 20);
1298+
game.add("Ada", 30);
1299+
game.add(Ranking.of("Poliana", 40));
1300+
1301+
List<Ranking> ranking = game.getRanking();
1302+
1303+
Counter home = factory.getCounter("home");
1304+
Counter products = factory.getCounter("products");
1305+
home.increment();
1306+
products.increment();
1307+
products.increment(3L);
1308+
----
1309+
12861310
== Riak
12871311

12881312
image::https://jnosql.github.io/img/logos/riak.png[Riak Project,align="center" width=25%,height=25%]

jnosql-redis/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>redis.clients</groupId>
3939
<artifactId>jedis</artifactId>
40-
<version>4.3.1</version>
40+
<version>4.4.3</version>
4141
</dependency>
4242
<dependency>
4343
<groupId>${project.groupId}</groupId>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2023 Eclipse Contribuitor
3+
* All rights reserved. This program and the accompanying materials
4+
* and Apache License v2.0 which accompanies this distribution.
5+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
6+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
7+
* You may elect to redistribute this code under either of these licenses.
8+
*/
9+
package org.eclipse.jnosql.databases.redis.mapping;
10+
11+
import jakarta.enterprise.context.ApplicationScoped;
12+
import jakarta.enterprise.inject.Disposes;
13+
import jakarta.enterprise.inject.Produces;
14+
import jakarta.enterprise.inject.Typed;
15+
import org.eclipse.jnosql.communication.Settings;
16+
import org.eclipse.jnosql.databases.redis.communication.RedisBucketManagerFactory;
17+
import org.eclipse.jnosql.databases.redis.communication.RedisConfiguration;
18+
import org.eclipse.jnosql.mapping.config.MicroProfileSettings;
19+
20+
import java.util.function.Supplier;
21+
import java.util.logging.Level;
22+
import java.util.logging.Logger;
23+
24+
@ApplicationScoped
25+
class BucketManagerFactorySupplier implements Supplier<RedisBucketManagerFactory> {
26+
27+
private static final Logger LOGGER = Logger.getLogger(BucketManagerFactorySupplier.class.getName());
28+
29+
@Override
30+
@Produces
31+
@Typed(RedisBucketManagerFactory.class)
32+
public RedisBucketManagerFactory get() {
33+
Settings settings = MicroProfileSettings.INSTANCE;
34+
RedisConfiguration configuration = new RedisConfiguration();
35+
return configuration.apply(settings);
36+
}
37+
38+
public void close(@Disposes RedisBucketManagerFactory factory) {
39+
LOGGER.log(Level.FINEST, "Closing RedisBucketManagerFactory resource");
40+
factory.close();
41+
}
42+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
~ Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
~ All rights reserved. This program and the accompanying materials
4+
~ are made available under the terms of the Eclipse Public License v1.0
5+
~ and Apache License v2.0 which accompanies this distribution.
6+
~ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
~ and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
~
9+
~ You may elect to redistribute this code under either of these licenses.
10+
~
11+
~ Contributors:
12+
~
13+
~ Otavio Santana
14+
-->
15+
16+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
17+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
19+
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
20+
bean-discovery-mode="annotated">
21+
</beans>

0 commit comments

Comments
 (0)