类:SQLTagStore


¥Class: SQLTagStore

此类表示一个用于存储预处理语句的 LRU(最近最少使用)缓存。

¥This class represents a single LRU (Least Recently Used) cache for storing prepared statements.

此类的实例是通过 database.createSQLTagStore() 方法创建的,而不是使用构造函数。存储根据提供的 SQL 查询字符串缓存预处理语句。当再次遇到相同的查询时,存储会检索缓存的语句并通过参数绑定安全地应用新值,从而防止 SQL 注入等攻击。

¥Instances of this class are created via the database.createSQLTagStore() method, not by using a constructor. The store caches prepared statements based on the provided SQL query string. When the same query is seen again, the store retrieves the cached statement and safely applies the new values through parameter binding, thereby preventing attacks like SQL injection.

缓存的 maxSize 默认为 1000 条语句,但可以提供自定义大小(例如,database.createSQLTagStore(100))。此类公开的所有 API 均同步执行。

¥The cache has a maxSize that defaults to 1000 statements, but a custom size can be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this class execute synchronously.