buildgrid.server.cas.storage.lru_memory_cache module
LRUMemoryCache
A storage provider that stores data in memory. When the size limit is reached, items are deleted from the cache with the least recently used item being deleted first.
- class buildgrid.server.cas.storage.lru_memory_cache.LRUMemoryCache(limit: int)
Bases:
StorageABC
- has_blob(digest: Digest) bool
Return True if the blob with the given instance/digest exists.
- get_blob(digest: Digest) IO[bytes] | None
Return a file-like object containing the blob. Most implementations will read the entire file into memory and return a BytesIO object. Eventually this should be corrected to handle files which cannot fit into memory.
The file-like object must be readable and seekable.
If the blob isn’t present in storage, return None.
- delete_blob(digest: Digest) None
Delete the blob from storage if it’s present.
- commit_write(digest: Digest, write_session: IO[bytes]) None
Store the contents for a digest.
The storage object is not responsible for verifying that the data written to the write_session actually matches the digest. The caller must do that.