v.vcache #

fn dlog #

fn dlog(fname string, s string)

fn new_cache_manager #

fn new_cache_manager(opts []string) CacheManager

struct CacheManager #

struct CacheManager {
pub:
	basepath       string
	original_vopts string
pub mut:
	vopts   string
	k2cpath map[string]string
}

Using a 2 level cache, ensures a more even distribution of cache entries, so there will not be cramped folders that contain many thousands of them. Most filesystems can not handle performantly such folders, and slow down. The first level will contain a max of 256 folders, named from 00/ to ff/. Each of them will contain many entries, but hopefully < 1000. NB: using a hash here, makes the cache storage immune to special characters in the keys, like quotes, spaces and so on. Cleanup of the cache is simple: just delete the $VCACHE folder. The cache tree will look like this: │ $VCACHE │ ├── README.md <-- a short description of the folder's purpose. │ ├── 0f │ │ ├── 0f004f983ab9c487b0d7c1a0a73840a5.txt │ │ ├── 0f599edf5e16c2756fbcdd4c865087ac.description.txt <-- build details │ │ └── 0f599edf5e16c2756fbcdd4c865087ac.vh │ ├── 29 │ │ ├── 294717dd02a1cca5f2a0393fca2c5c22.o │ │ └── 294717dd02a1cca5f2a0393fca2c5c22.description.txt <-- build details │ ├── 62 │ │ └── 620d60d6b81fdcb3cab030a37fd86996.h │ └── 76 │ └── 7674f983ab9c487b0d7c1a0ad73840a5.c

fn (CacheManager) set_temporary_options #

fn (mut cm CacheManager) set_temporary_options(new_opts []string)

set_temporary_options can be used to add temporary options to the hash salt NB: these can be changed easily with another .set_temporary_options call without affecting the .original_vopts

fn (CacheManager) key2cpath #

fn (mut cm CacheManager) key2cpath(key string) string

fn (CacheManager) postfix_with_key2cpath #

fn (mut cm CacheManager) postfix_with_key2cpath(postfix string, key string) string

fn (CacheManager) exists #

fn (mut cm CacheManager) exists(postfix string, key string) ?string

fn (CacheManager) save #

fn (mut cm CacheManager) save(postfix string, key string, content string) ?string

fn (CacheManager) load #

fn (mut cm CacheManager) load(postfix string, key string) ?string