The tool session class package called by hiredis C library.

Call functions: int32_t seasonId = 0; { pRedisSession->commandF(“HGET {} season_id”, strArenaConfig); RedisReply r(pRedisSession->getReply()); if (r.isString()) { auto buffer = r.getString(); seasonId = std::atoi(buffer.c_str()); } } head File: #pragma once #include “prerequisites.h” #include <hiredis.h> class RedisReply { public: explicit RedisReply(redisReply* r); ~RedisReply() = default; void copy(redisReply* r); int getType() const { return m_type; } bool isNil() […]

Session+Cookie

severlet uploads a single file Use the annotation @MultipartConfig to identify each Servlet as supporting file upload Servlet encapsulates the POST request of multipart/form-data into a Part object, and operates the uploaded file through Part. Common methods public Collection getHeaderNames() // Used to get all the request headers contained in this part of the data […]

JavaScript local storage (solve cross-domain issues, session domain and cookies cannot be set from the backend)

1. Method javaScriptThere are four main methods of local caching: cookies sessionStorage localStorage indexedDB cookie Cookie, a type of “small text file”, refers to the data that some websites store on the user’s local terminal in order to identify the user’s identity. It is to solve the problems caused by HTTP statelessness As a small […]

session and cookie mechanism

2023.10.23 Domain Object Let me first summarize the domain objects I know so far: request (corresponding class name: HttpServletRequest) Request domain (request level) session (corresponding class name: HttpSession) Session domain (user level) application (corresponding class name: ServletContext) Application domain (project level, shared by all users.) The size relationship between these three domain objects request < […]

Cookies and Sessions

Expansion of the preface: In the previous stage of learning front-end literacy, the author wrote a simple and easy-to-read confession wall project. The specific front-end code is as follows: <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <title>Confession wall</title> <style> /* * Wildcard selector, selects all elements on the […]

SpringBoot configures redis multiple databases and sets session storage to redis

Click here to reprint directly Create a springboot project The application.yml file is configured like this server: port: 8888 spring: data: redis: database: 0 #session stores the default database database-db: #Multiple database configuration db0: 0 db1: 1 db7: 7 host: 127.0.0.1 port: 6379 password: 123456 jedis: pool: #Maximum number of connections max-active: 8 #Maximum blocking […]

Spring Session Framework

Spring Session Framework Foreword Spring Session is a framework for managing sessions in distributed environments. It provides a stateless way to manage user sessions, allowing applications to share session data between different servers. Spring The design goal of Session is to solve the limitations of traditional Servlet container-based session management, especially in cluster and cloud […]

Nginx operation (load balancing, dynamic and static separation, session maintenance, anti-leeching)

1. Control nginx service through nginx command nginx -c /path/nginx.conf # Start nginx with the configuration file in a specific directory:nginx -s reload # Reload after modifying the configuration to take effect nginx -s reopen # Reopen the log file nginx -s stop # Quickly stop nginx nginx -s quit # Stop nginx completely and […]