piermesh/docs/Daisy/Cache.md

40 lines
1010 B
Markdown
Raw Normal View History

2024-08-01 22:03:59 +00:00
<a id="daisy-based-cache"></a>
2024-08-01 01:09:11 +00:00
# Daisy based cache
2024-11-26 17:43:02 +00:00
### *class* Daisy.Cache.Cache(daisyCryptography, filepaths=None, cacheFile=None, path: str = 'daisy', walk: bool = False)
2024-08-01 01:09:11 +00:00
2024-11-26 17:43:02 +00:00
In memory collection of Daisy records, provides a search functionality currently utilized by Daisy.Catch.Catch
2024-08-01 01:09:11 +00:00
2024-08-01 22:03:59 +00:00
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Daisy/Cache.py)
2024-11-26 17:43:02 +00:00
#### create(path: str, data: dict, remote=False)
2024-08-01 01:09:11 +00:00
Create new record
* **Parameters:**
* **path** (*str*) Path to create record at
* **data** (*dict*) Data to populate record with
2024-11-26 17:43:02 +00:00
* **remote** (*bool*) Whether this is a reference to a distributed file (not implemented yet)
2024-08-01 01:09:11 +00:00
#### get(path: str)
Get record at path, else return False
path: str
: Path of record
#### refresh()
Reload from disk to memory
#### search(keydict: dict, strict: bool = True)
2024-11-26 17:43:02 +00:00
Search cache for record for records with keys and values matching those
in the keydict
2024-08-01 01:09:11 +00:00
keydict: dict
strict: bool
2024-11-26 17:43:02 +00:00
: Whether to require all keys/values match