Transactions and locking mechanisms in Redis

Transaction and lock mechanism in Redis Redis’s transaction mechanism is a mechanism that packages multiple commands for execution, ensuring that all of these commands either execute successfully or fail without any intermediate status. In Redis, transactions are implemented through four commands: MULTI, EXEC, DISCARD and WATCH. MULTI: This command marks the beginning of a transaction. […]

[SpringBoot] Spring’s AOP combined with Redis implements current limiting for SMS interfaces

Article directory Preface 1. Preparation work 2. Current limiting annotation 3. Customize or select redisTemplate 1. Customize RedisTemplate (depending on needs, I use the second option) 2. Use StringRedisTemplate directly 4. Open lua script 5.Annotation analysis 6.Interface testing Foreword Scenario: In order to limit the number of visits to the SMS verification code interface and […]

Four specific type conversion mechanisms in C++

In C++, there are four specific type conversion mechanisms, namely: static_cast (static conversion, executed at compile time) static_cast can perform type conversion on objects, but this conversion is determined at compile time. It applies to the following situations: Pointer type from pointer type to base type. From a pointer type of a base type to […]

uniappSMS verification code input box

The requirement is that the SMS verification code requires a grid input box, as shown in the picture I found a case online and changed it. Just upload the code. Structure <template> <view class=”verify-code”> <!– Input box –> <input id=”input” :value=”code” class=”input” :focus=”isFocus” :type=”inputType” :maxlength=”itemSize” @input=”onInput” @focus=”inputFocus” @blur=”inputBlur” /> <!– Cursor –> <view id=”cursor” v-if=”cursorVisible […]

Strings and ownership mechanisms in Rust

Article directory 1. string 2. Ownership 2.1 Ownership and Scope 2.2 Operations on ownership 2.2.1 Transfer 2.2.3 Copy 2.2.3 Delivery 2.3 Quotes 2.3.1 Borrowing 2.3.2 Mutable references 1. string I have learned that Rust only has a few basic data types, but there is no commonly used string, which is String. Today, let’s learn about […]

C++ – Implementing events and delegates, signals and slots mechanisms using the standard library

Use the C++ standard library to simply implement event triggering mechanism Event.h /* Author:StubbornHuang Data:2023.1.31 Email:[email protected] */ #ifndef _EVENT_H_ #define _EVENT_H_ #include <functional> #include <map> #include <type_traits> #ifndef EVENT_NO_THREAD_SAFETY #define EVENT_THREAD_SAFETY #endif // !EVENT_NO_THREAD_SAFETY #ifdef EVENT_THREAD_SAFETY #include <atomic> #include <mutex> #endif // EVENT_THREAD_SAFETY #ifdef EVENT_THREAD_SAFETY #define DELEGATE_ID_TYPE std::atomic_uint64_t #else #define DELEGATE_ID_TYPE std::uint64_t #endif // EVENT_THREAD_SAFETY […]