Zero Cache is able to store data of any type that are addressed by
index numbers. It provides the minimal response time thanks to direct memory
copying between the user space and kernel space.
Usage example
This is example of typical C++ client application:
#include <zero-cache/typed_client.h>
using namespace zero_cache;
int main()
{
TypedClient client;
size_t index = 0;
long data = 1024;
client.WriteLong(index, data);
long result = client.ReadLong(index);
return 0;
}
This is example of typical C client application:
#include <zero-cache/zero_cache.h>
int main()
{
int dev_file;
dev_file = open(DEVICE_FILE_NAME, 0);
long data;
data = 1024;
Package package;
package.index = 0;
memcpy(&package.data, data, PACKAGE_DATA_SIZE);
ioctl(dev_file, IOCTL_WRITE_VALUE, &package);
long result;
package.index = 0;
ioctl(dev_file, IOCTL_READ_VALUE, &package);
memcpy(result, &package.data, PACKAGE_DATA_SIZE);
close(dev_file);
return 0;
}