Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to operate redis

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to operate redis for everyone, Xiaobian thinks it is quite practical, so share it with everyone for a reference, I hope you can gain something after reading this article.

Redis is a high-performance key-value database. The emergence of redis largely compensates for the lack of keyvalue storage such as memcached, which can complement relational databases in some cases. It provides Python, Ruby, Erlang, PHP client, easy to use.

Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

Redis is an open source software that can be used as a database, cache and message broker, supports complex data structures, redis natively supports replicas, least-recently used retirement policies and transaction options, provides different levels of consistency, and provides high availability through sentinel mode and cluster automatic allocation.

Let me start with the simplest example of stand-alone redis.

Redis official is no win version, but Microsoft Open Tech group on GitHub developed a win version of redis, project address: https://github.com/MSOpenTech/redis, software release address: https://github.com/MSOpenTech/redis/releases. Download it, cd it to redis directory and execute redis-server.exe redis.windows.conf to start redis, redis default port is 6379

Search the maven repository for jedis jar packages to add to the project, and then you can operate redis.

package redisOne;import redis.clients.jedis.Jedis;public class RedisUtil{ private static Jedis jedis=new Jedis("127.0.0.1", 6379); public static String getOneKey(String key){ String value=jedis.get(key); jedis.close(); return value; } public static void setOneKey(String key,String value){ jedis.set(key,value); jedis.close(); } public static void main(String[] args) { RedisUtil.setOneKey("liuc","liuc"); System.out.println(RedisUtil.getOneKey("liuc")); }} About "how to operate redis" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report