-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache.h
More file actions
23 lines (18 loc) · 764 Bytes
/
cache.h
File metadata and controls
23 lines (18 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#include "string.h"
#include "channel.h"
struct fileCache;
typedef struct fileCache *fileCache_t;
/**
* Creates a file cache. Does not take ownership of any of the parameters.
*/
fileCache_t createFileCache(size_t maxBytes, int workingDirectory, channel_t logger);
void destroyFileCache(fileCache_t self);
/**
* Retrieves the contents of the file with the specified path relative to working
* directory. Multi-threaded safe.
* @param path the relative path to the file. This does not take ownership of path.
* @return the contents of the file. Ownership is passed to the calling thread. Returns different
* object for each evocation. NULL if the file could not be found.
*/
string_t fileCacheGetFile(fileCache_t cache, const char *path);