类:SQLTagStore
【Class: SQLTagStore】
此类表示用于存储预处理语句的单个 LRU(最近最少使用)缓存。
【This class represents a single LRU (Least Recently Used) cache for storing prepared statements.】
该类的实例是通过 database.createTagStore() 方法创建的,而不是使用构造函数。该存储会根据提供的 SQL 查询字符串缓存准备好的语句。当再次遇到相同的查询时,存储会检索缓存的语句,并通过参数绑定安全地应用新值,从而防止 SQL 注入等攻击。
【Instances of this class are created via the database.createTagStore() 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.createTagStore(100))。该类提供的所有 API 都是同步执行的。
【The cache has a maxSize that defaults to 1000 statements, but a custom size can be provided (e.g., database.createTagStore(100)). All APIs exposed by this class execute synchronously.】