Apache Shiro to use the custom cache to implement the CacheManager and cache for both interfaces
Shiro has three important cache Interfaces:cachemanager cache Cachemanageraware
A CacheManager returns cache instances and various Shiro components
Operating on Linux: REDIS-CLI link redis-cli-a password
You can also enter the password individually: 127.0.0.1:6379>auth d3bcc7a988ad2d652276bca0ad8141a5
To view an existing key value pair: 127.0.0.1:6379> keys *
Configure master-Slave
single-Machine multi-instance Redis master-slave replication configuration
Redis principal and subordinate copy principle look here.
Master Redis's main configuration file is as follows:
/etc/init.d/redis_6379 boot
/etc/redis/redis_6379.conf
Redis uses its own implementation of the event separator, high efficiency, the internal use of non-blocking execution mode, throughput capacity is relatively large.
However, because the general memory operation is simple access operation, the
Download Redis and install
$ cd/home/redis
$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz
$ tar xzf Redis-3.0.2.tar.gz
$ cd redis-3.0.2
$ make
$ make install
boot, in the Redis file below the src file
$ cd src
$ ./redis-server
or
The data structures supported in Redis are much more than memcached, such as basic strings, hash tables, lists, collections, sortable sets, as well as the various operations on the data structure, which is an important reason for Redis to be popular.
Java Web projects, which do not rely on web containers for load balancing, must address session sharing issues. There are many online solutions, but I think the use of Spring-session +redis is the most efficient, do not have to reinvent the wheel,
1. Normal execution
MULTI
Set K1 v1
Set K2 v2
Get K1
Set K3 v3
Exec
2. Discard Transactions
MULTI
Set K1 v1
Set K2 v2
Set K3 v3
DISCARD
3. All guilt
MULTI
Set K1 v1
Set K2 v2
Set K3 v3
Getset K3
Set K4 v4
Set K5 v5
Exec
ERROR,
4.
Redis gets no connectivity issues
Problem ScenarioWhen we inherited Redis, it was probably just a simple integration that guaranteed access to the data, but sometimes when we used Redis, there was a case where Redis couldn't get a connection. The
Holiday over, hurry to update the east, the recent project has been on the line stage, daily overtime debugging optimization module function, resulting in a few days back home is already midnight. Okay, here we are.
some small summaries of Redis
Package Com.zm.blog.config.shiro;
Import org.apache.shiro.session.Session;
Import Org.apache.shiro.session.SessionListener;
public class Myshirosessionlistener implements Sessionlistener {
//The session is created with the trigger
@Override
The key in the Redis key-value pair is of type string. What does the Redis internal implementation do with string? The Redis bottom is written in C, for STIRNG does not directly use the C character array, but instead encapsulates a type of SDS. The
To turn off the firewall:Systemctl Stop Firewalld.service #停止firewallSystemctl Disable Firewalld.service #禁止firewall开机启动Firewall-cmd--state #查看默认防火墙状态 (show notrunning after turn off, show running when turned on)To Configure the compilation
Redis's set is an unordered collection of type string. A collection member is unique, which means that the collection cannot have duplicate data.
The collection in Redis is represented by a hash table, so the complexity of adding, deleting, and
The Redis Save command is used to create a backup of the current database.
Grammar
Example
Redis 127.0.0.1:6379> SAVE
OKThis command will create the Dump.rdb file in the Redis installation directory.
Recovering Data
If you need to recover
Today, I accidentally saw a piece of code that was previously optimized for a similar problem. But this problem again and again again appear, really think yards nong, also not who can be good. Details determine success or failure, the style of doing
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.