How to implement redis distributed lock
Distributed lock is a way to control the synchronous access of shared resources between distributed systems.
In the distributed system, they often need to coordinate their actions. If different systems or different hosts of the same system share one or a group of resources, when accessing these resources, they often need to be mutually exclusiv ...
Posted by Jeroen_nld on Fri, 10 Apr 2020 23:02: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
Tron Block Chain PHP Docking Development Kit [TronTool]
The TronTool development kit is designed to rapidly increase support for Tron/USDT-TRC20 digital assets for PHP applications in scenarios that use their own Tron block chain nodes as well as in lightweight deployment scenarios based on Tron's official public API services.Official TronTool download address: http://sc.hubwiz.com/codebag/tron-php- ...
Posted by bmbc on Thu, 09 Apr 2020 18:42:42 -0700
eyoucms article image lazy loading
Because of the mobile terminal's network speed and other reasons, when we browse articles with large pictures, there is an unfriendly experience. Lazy loading of pictures can make up for this problem. For the consideration of mobile terminal lightweight, this case uses the smaller zepto.picLazyLoad.min.js instead of jquery, and the plug-in can ...
Posted by p0pb0b on Thu, 09 Apr 2020 09:10:09 -0700
Traversal with PHP iterator
We know that PHP traversal is actually an iterator operation. From PHP5, there is an iterator interface, as follows
/**
* Interface for external iterators or objects that can be iterated
* themselves internally.
* @link https://php.net/manual/en/class.iterator.php
*/
interface Iterator extends Traversable {
/**
* Return t ...
Posted by wsantos on Tue, 07 Apr 2020 08:36:04 -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
thinkphp6+swagger-php Configuration Management Interface Document
swagger2 was upgraded to 3 and renamed OpenAPI Spec, with some changes in all partial annotations, which are configured here with thinkphp6+swagger-php3.0
1. The front-end part git or dowload a swagger-ui to be able to access the service directory, such as where my nginx configuration points to the thinkphp6 root directory public, so download ...
Posted by Topper on Mon, 06 Apr 2020 09:27:14 -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
A collection of code examples of API calls for travel services: long distance bus query, train ticket query, etc
The following example code applies to www.apishop.net For the API under the website, you need to apply for the corresponding API service before using the interface call code examples mentioned in this article.
Coach query Long distance bus time query and bus station query in major cities in China
Vehicle Daquan : in ...
Posted by nogeekyet on Sun, 05 Apr 2020 14:57:20 -0700