Tag:atom

  • The interviewer asked: what is the solution to prevent duplicate requests?

    Time:2021-6-11

    background In normal development, we often face the problem of preventing duplicate requests. When the server response to the request involves data modification or state change, it may cause great harm. The consequences of repeated requests are especially serious in the transaction system, after-sales rights protection and payment system. But most of the time, they […]

  • Redis notes – set command (involving distributed locks)

    Time:2021-6-10

    SET key value [EX seconds] [PX milliseconds] [NX|XX] EX seconds :  Set the expiration time of the key to   seconds   Seconds.   implement   SET   key   value   EX   seconds   The effect is equivalent to execution   SETEX   key   seconds   value  。PX milliseconds :   Set the expiration time of […]

  • JAVA memory model that Xiaobai can understand

    Time:2021-6-10

    preface Java Concurrent Programming Series has opened a hole. It can be said that Java Concurrent Programming is a necessary literacy for middle and senior R & D engineers, and it is also a necessary question for middle and senior job interviews. This series is to lead readers to break through the difficulties of Java […]

  • Go: 1234 about locks

    Time:2021-5-12

    We mentioned mutex and atomic in the last article “the story of stepping on a pit: go serves the supernatural panic”. I feel that it’s not enough. Let’s expand this article. –   lock  – We have talked about a lot of interview questions before. In fact, locks are also suitable for set questions. For […]

  • Three step development of static page

    Time:2021-4-24

    preface Recently, I was responsible for the front-end work of version 2.0 of the company’s official website. I only write static pages, and I don’t need the joint debugging of management interface. That is to say, the legend of cut diagram ~, and I don’t need too much technology. Now the front-end technology is changing […]

  • Atomic operation of redis auto incrementing incr to set expiration time (Lua & PHP Implementation)

    Time:2021-4-20

    The auto increment operation of redis does not have a native expiration time setting. It can only auto increment first and then set the expiration time through expiration. If the expiration time setting fails under special circumstances, it will lead to business errors. The following is based on PHP and Lua script to write a […]

  • Source code analysis of abstractqueuedsynchronizer

    Time:2021-4-12

    summary Abstract queued synchronizer (AQS) provides an abstract implementation of synchronizer framework. Concurrency classes such as reentrantlock, semaphore, countdownlatch and cyclicbarrier are all implemented based on AQS. The specific usage is to inherit AQS to implement its template method, and then take subclasses as internal classes of synchronization components. Source code analysis Member variable Head […]

  • Goroutine

    Time:2021-3-21

    Goroutine is essentially a large asynchronous execution handle, which is better than the single threaded event loop processor in nodejs. The reason why we can’t feel asynchronous when using goroutine is that golang has encapsulated all kinds of asynchronous IO operations. Once the state of asynchronous IO changes, we can switch goroutine timely. Let you […]

  • When to use volatile keyword?

    Time:2021-3-18

    You must have seen volatile keyword before, but do you know when you need to use volatile keyword? Look directly at the following code: int a = 100; while (a == 100) { // code } When this program is compiled, if the compiler finds that the program does not attempt to change the value […]

  • The original redis distributed locks of big factories are designed in this way!

    Time:2021-3-12

    1 local lock Commonly used JDK locks, such as synchronize or lock, can only lock the current process and are only applicable to single architecture services. In the scenario of distributed multi service instances, distributed locks must be used 2 distributed lock 2.1 principle of distributed lock Toilet pit theory You can go to one […]

  • Notes on regular expressions (1)

    Time:2021-3-9

    summary A regular expression is a set of rules declared in advance to match characters in a string. Basic grammar Metacharacter In the pattern of regular expressions, some characters have special meanings, which are calledMetacharacter. Metacharacters are all for single character matching. \wMatch the upper and lower case English characters and any one of the […]

  • Redis used in springboot

    Time:2021-2-6

    Introduction to redis Installing redis in Linux Description of redis Redis is an open source, in memory data structure storage system, which can be used as database, cache and message middleware. It supports multiple types of data structures 1. Redis common commands String type: command explain case set Add key value set username admin get […]