Crate rocket_file_cache [] [src]

Structs

Cache

The Cache holds a set number of files. The Cache acts as a proxy to the filesystem. When a request for a file is made, the Cache checks to see if it has a copy of the file. If it does have a copy, it returns the copy. If it doesn't have a copy, it reads the file from the FS and tries to cache it. If there is room in the Cache, the cache will store the file, otherwise it will increment a count indicating the number of access attempts for the file. If the number of access attempts for the file are higher than the least in demand file in the Cache, the cache will replace the low demand file with the high demand file.

CachedFile

The structure that is returned when a request to the cache is made. The CachedFile knows its path, so it can set the content type when it is serialized to a request.

SizedFile

The structure that represents a file in memory.

Enums

CacheInvalidationError
CacheInvalidationSuccess

Type Definitions

PriorityFunction

Custom type of function that is used to determine how to add files to the cache. The first term will be assigned the access count of the file in question, while the second term will be assigned the size (in bytes) of the file in question. The result will represent the priority of the file to remain in or be added to the cache. The files with the largest priorities will be kept in the cache.