initial commit

This commit is contained in:
brent saner
2024-12-17 17:39:10 -05:00
commit 010643757e
29 changed files with 1644 additions and 0 deletions

35
cachedb/funcs.go Normal file
View File

@@ -0,0 +1,35 @@
package cachedb
import (
`os`
`path/filepath`
`r00t2.io/sysutils/paths`
)
/*
NewCache returns a Cache from path to SQLite file `db` (or ":memory:" for an in-memory one).
It will be created if it doesn't exist for persistent caches.
*/
func NewCache(db string) (c *Cache, err error) {
var exists bool
switch db {
case ":memory:":
default:
if exists, err = paths.RealPathExists(&db); err != nil {
return
}
if !exists {
if err = os.MkdirAll(filepath.Dir(db), 0700); err != nil {
return
}
if err = os.WriteFile()
}
}
// TODO
return
}