How to use Redis service in Golang
During development, if there is a need for caching, you may need to add a Redis block to the background. The core package is open-source
github.com/garyburd/redigo
This package provides the connection of redis service and encapsulates various command functions of redis
1. First, install redis service for the comput ...
Posted by trilbyfish on Fri, 10 Apr 2020 08:36:20 -0700
docker + redis + beanstalkd + swoole to build a robust queue
The technologies used are docker + redis + beanstalkd + swoole
#Download redis and beanstalkd from the warehouse
docker pull redis:5.0.7
docker pull schickling/beanstalkd
#View image list
docker images
#Running beanstalkd in the docker container and mapping to the local host port 11300
docker run --name beanstalkd -d -it -p 11300 ...
Posted by genix2011 on Fri, 10 Apr 2020 07:46:22 -0700
Teach you to use swoole to monitor redis data
swoole How to monitor redis data?
Laravel uses swoole to monitor redis
Before you start, make sure redis is installed properly and running properly.
Laravel code
Create a RedisTest event in the App\Events directory
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\B ...
Posted by sleepingdanny on Fri, 10 Apr 2020 07:32:55 -0700
Spring Cache defect, I seem to have a solution
Spring Cache defect
Spring Cache is a very good cache component.
But in the process of using Spring Cache, Xiao Hei also encountered some pain points.
For example, now there is a requirement: obtain user information in batches through multiple userids.
Option 1
At this point, our code may be as follows:
List<User> users = ids.strea ...
Posted by dfownz on Wed, 08 Apr 2020 04:56:35 -0700
How to reduce scan time of Hyperf frame
Reason
The Hyperf framework is designed to prevent the proxy cache from not updating after the user updates the component, resulting in a startup error. The following hooks have been added.
{
"scripts": {
"post-autoload-dump": [
"init-proxy.sh"
]
}
}
The init-proxy.sh script executes the PHP bin / h ...
Posted by aisalen on Tue, 07 Apr 2020 01:16:34 -0700
PHP magic method
Constructors and Destructors
__construct constructor
Class calls this method every time a new object is created, so it's a good place to do some initialization before using the object.
__deconstruct
Destructors execute when all references to an object are deleted or when the object is explicitly destroyed.
<?php
class MyDestructa ...
Posted by Caesar on Mon, 06 Apr 2020 01:57:18 -0700
007. Use of J.U.C locks
1. Lock API
1. Locks package class hierarchy
2. Lock interface
Method Signature
describe
void lock();
Acquire locks (endless)
boolean tryLock();
Acquire locks (just try it)
boolean tryLock(long time, TimeUnit unit) throws InterruptedException;
Acquire locks (out of date)
void lockInterruptibly() throws InterruptedException;
Acquire ...
Posted by Smasher on Sun, 05 Apr 2020 17:27:36 -0700
linux Installation of nginx, jdk, redis
Because the project needs to apply for a new server, it is necessary to reconfigure the environment.
nginx installation:
One click installation of four dependencies:
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
Enter / usr/local/src directory and create nginx folder
cd /usr/local/src
mkdir nginx
Enter the nginx ...
Posted by jasonman1 on Sun, 05 Apr 2020 14:12:46 -0700
Dry | Comic algorithm: LRU from implementation to application-level analysis (first lecture)
Today we share with you the well-known LRU algorithm. The first lecture consists of four sections.
Overview of LRU
LRU usage
LRU implementation
Overview of Redis Near LRU
Part I: Overview of LRU
LRU is an abbreviation for Least Recently Used, translated as least recently used.Its rationale is that "recently used data will remain in use f ...
Posted by verdrm on Sun, 05 Apr 2020 11:46:20 -0700
[Java Series 004] don't underestimate Redis distributed lock
Hello, I'm miniluo. For positions requiring distributed experience, interviewers always like to ask questions about distributed locks. Recently, I have the honor to participate in the company's interview, and I often ask about the knowledge of distributed locks. Most of the candidates' answers are more limited to using, and they have not though ...
Posted by Sekka on Sun, 05 Apr 2020 01:39:05 -0700