I'm using sqlite3 interface engine for create and use the following table on my C project.
I wish to modify it to act as LRU cache, meaning that each record will have timestamp and upon insertion, if the db is full, the record to be inserted will come instead of the last recently used existed record.
This is how I use my table : upon creation :
CREATE TABLE IF NOT EXISTS mytable ( key1 TEXT COLLATE NOCASE, key2 INTEGER, data BLOB, PRIMARY KEY (key1, key2))
upon insertion of record into db :
INSERT OR REPLACE INTO mytable VALUES ( :key1, :key2, :data )
upon reading of record into db :
SELECT * FROM mytable WHERE key1='<text_input>' COLLATE NOCASE AND key2='<int_input>' COLLATE NOCASE
Aucun commentaire:
Enregistrer un commentaire