You need to sign in or sign up before continuing.
Commit 18527950 authored by Samarth Joshi's avatar Samarth Joshi

Added dynamic lru cache size

parent 092592f7
No preview for this file type
No preview for this file type
......@@ -148,7 +148,7 @@ int main(int argc, char const *argv[])
int seconds = 1;
int i;
if(0) {
if(1) {
sock = client_init();
interactive(sock);
return 0;
......
......@@ -204,7 +204,6 @@ int main (int argc, int argv) {
printf("%d\n", settings->listening_port);
printf("%d\n", settings->cache_size);
printf("%d\n", settings->thread_pool_size);
return 0;
//int *pipes = (int*) malloc(pool_thread_size * 2 * sizeof(pipes));
int pipes[50][2]; // TODO: initialize pipes dynamically
......
......@@ -12,7 +12,7 @@
#define CLEAR __atomic_clear
struct KV *array[];
struct KV **array;
struct queue *qu=NULL;
struct queue *last;
unsigned _Atomic lock=0;
......@@ -180,7 +180,7 @@ int cache_get(char *key, char *value)
void init_cache(int size) {
maxsize = size;
array = (struct KV *) malloc(maxsize * sizeof(struct KV));
array = (struct KV **) malloc(maxsize * sizeof(struct KV));
for(int j=0;j<maxsize;j++)
{
array[j] = (KV *)malloc(sizeof(KV));
......
......@@ -26,7 +26,7 @@ struct queue{
struct queue *next;
};
extern struct KV *array[];
extern struct KV **array;
extern struct queue *qu;
extern struct queue *last;
......
No preview for this file type
listening_port=8000
cache_size=10
cache_size=15
thread_pool_size=10
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment