Skip to content

Commit

Permalink
Merge pull request #198 from invisal/only-cache-small-statement
Browse files Browse the repository at this point in the history
fix: only cache statement under 5kb
  • Loading branch information
penberg authored Jun 3, 2024
2 parents 755561c + 06debb5 commit 8da38aa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/libsql-client/src/sql_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export class SqlCache {
}
const sqlText = hranaStmt.sql;

// Stored SQL cannot exceed 5kb.
// https://github.com/tursodatabase/libsql/blob/e9d637e051685f92b0da43849507b5ef4232fbeb/libsql-server/src/hrana/http/request.rs#L10
if (sqlText.length >= 5000) {
continue;
}

let sqlObj = this.#sqls.get(sqlText);
if (sqlObj === undefined) {
while (this.#sqls.size + 1 > this.capacity) {
Expand Down

0 comments on commit 8da38aa

Please sign in to comment.