template <typename T, typename ObjectPoolPolicyT = DefaultObjectPoolPolicy<T>, uint32_t FramesUntilEviction = 4>

class HashCache

Defined at line 80 of file ../../src/ui/lib/escher/util/hash_cache.h

Provides a frame-based cache that evicts items that haven't been used for

|FramesUntilEviction| frames. In other words:

- if FramesUntilEviction == 0, there is no frame-to-frame caching; items are

evicted even if they were used in the previous frame.

- if FramesUntilEviction == 1, items are evicted if they were not used in the

previous frame, otherwise they remain in the cache.

- if FramesUntilEviction == 2, items are evicted if two frames pass without

the resource being used.

- and so on...

Clients are responsible for not using the cached object after it has been

evicted from the cache. The recommended way to do this is to re-request

cached objects every frame (or even more often).

Public Methods

template <typename... Args>
void HashCache<T, ObjectPoolPolicyT, FramesUntilEviction> (Args &&... args)

Defined at line 83 of file ../../src/ui/lib/escher/util/hash_cache.h

void ~HashCache<T, ObjectPoolPolicyT, FramesUntilEviction> ()

Defined at line 84 of file ../../src/ui/lib/escher/util/hash_cache.h

void Clear ()

Defined at line 86 of file ../../src/ui/lib/escher/util/hash_cache.h

void BeginFrame ()

Defined at line 98 of file ../../src/ui/lib/escher/util/hash_cache.h

std::pair<T *, bool> Obtain (Hash hash)

Defined at line 103 of file ../../src/ui/lib/escher/util/hash_cache.h

size_t cache_hits ()

Defined at line 135 of file ../../src/ui/lib/escher/util/hash_cache.h

size_t cache_misses ()

Defined at line 136 of file ../../src/ui/lib/escher/util/hash_cache.h

size_t size ()

Defined at line 137 of file ../../src/ui/lib/escher/util/hash_cache.h

const ObjectPoolType & object_pool ()

Defined at line 141 of file ../../src/ui/lib/escher/util/hash_cache.h