Valuecache

Offers a simple cache mechanism for objects needed in submodules either often or which are costly to construct or deconstruct.

Summary
ValuecacheOffers a simple cache mechanism for objects needed in submodules either often or which are costly to construct or deconstruct.
CopyrightThis program is free software.
Files
C-kern/api/cache/valuecache.hHeader file of Valuecache.
C-kern/cache/valuecache.cImplementation file Valuecache impl.
Types
struct valuecache_tExports valuecache_t.
Functions
test
unittest_cache_valuecacheTest allocation and free works.
valuecache_tCaches values which have to be computed only once.
pagesize_vmThe size of a virtual memory page in bytes.
log2pagesize_vmThe log2_int value of pagesize_vm.
lifetime
valuecache_FREEStatic initializer.
init_valuecacheSets values of valuecache.
free_valuecacheClears values of valuecache.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/cache/valuecache.h

Header file of Valuecache.

C-kern/cache/valuecache.c

Implementation file Valuecache impl.

Types

struct valuecache_t

typedef struct valuecache_t valuecache_t

Exports valuecache_t.

Functions

Summary
test
unittest_cache_valuecacheTest allocation and free works.

test

unittest_cache_valuecache

int unittest_cache_valuecache(void)

Test allocation and free works.

valuecache_t

struct valuecache_t

Caches values which have to be computed only once.

Summary
pagesize_vmThe size of a virtual memory page in bytes.
log2pagesize_vmThe log2_int value of pagesize_vm.
lifetime
valuecache_FREEStatic initializer.
init_valuecacheSets values of valuecache.
free_valuecacheClears values of valuecache.

pagesize_vm

uint32_t pagesize_vm

The size of a virtual memory page in bytes.  Same value as returned by sys_pagesize_vm.  This value can be queried with function pagesize_vm.

log2pagesize_vm

uint8_t log2pagesize_vm

The log2_int value of pagesize_vm.

lifetime

valuecache_FREE

#define valuecache_FREE { 0, 0 }

Static initializer.

init_valuecache

int init_valuecache(/*out*/valuecache_t *valuecache)

Sets values of valuecache.

free_valuecache

int free_valuecache(valuecache_t *valuecache)

Clears values of valuecache.

Offers a simple cache mechanism for objects needed in submodules either often or which are costly to construct or deconstruct.
Implements Valuecache.
typedef struct valuecache_t valuecache_t
Exports valuecache_t.
struct valuecache_t
Caches values which have to be computed only once.
int unittest_cache_valuecache(void)
Test allocation and free works.
uint32_t pagesize_vm
The size of a virtual memory page in bytes.
uint8_t log2pagesize_vm
The log2_int value of pagesize_vm.
Implements int_t.log2_int as a generic function.
#define valuecache_FREE { 0, 0 }
Static initializer.
int init_valuecache(/*out*/valuecache_t *valuecache)
Sets values of valuecache.
int free_valuecache(valuecache_t *valuecache)
Clears values of valuecache.
uint32_t sys_pagesize_vm(void)
Returns the virtual memory page size supported by the underlying system.
Close