Redis Cache libraries for Java
Overview
Azure Redis Cache is a secure, distributed key-value store based on the popular open source Redis cache.
To get started with Azure Redis Cache, see How to use Azure Redis Cache with Java.
Client library
Connect to Azure Redis Cache and store and retrieve values from the cache using the open-source Jedis client.
Add a dependency to your Maven pom.xml
file to use the client library in your project.
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
<type>jar</type>
</dependency>
Example
Connect to Azure Redis and insert a string into the cache.
JedisShardInfo shardInfo = new JedisShardInfo("<name>.redis.cache.windows.net", 6380, useSsl);
shardInfo.setPassword("<key>"); /* Use your access key. */
Jedis jedis = new Jedis(shardInfo);
jedis.set("foo", "bar");
Management API
Create and scale Azure Redis resources and manage access keys to with the management API.
Add a dependency to your Maven pom.xml
file to use the resource management libraries in your project.
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager</artifactId>
<version>2.1.0</version>
</dependency>
For detailed information on how to use the Java resource management libraries, please refer to this doc
Example
Create a new Azure Redis Cache in the two-node standard tier.
RedisCache cache = azure.redisCaches().define(redisCacheName)
.withRegion(Region.US_CENTRAL)
.withNewResourceGroup(rgName)
.withStandardSku();
Samples
Explore more sample Java code for Azure Redis Cache you can use in your apps.
Azure SDK for Java
Opinia
https://aka.ms/ContentUserFeedback.
Dostępne już wkrótce: W 2024 r. będziemy stopniowo wycofywać zgłoszenia z serwisu GitHub jako mechanizm przesyłania opinii na temat zawartości i zastępować go nowym systemem opinii. Aby uzyskać więcej informacji, sprawdź:Prześlij i wyświetl opinię dla