#include <stdlib.h>
#include <stdio.h>
#include "time_queue.h"
Go to the source code of this file.
Functions unsigned long time_queue_hash (unsigned char *str) Internal: generates a djb2 hash.A time queue is a datastructure which allows to store time for a finite number of keys. It allows to check if, for a given key, a limit per unit of time is reached or not.
Definition in file time_queue.c.
Function DocumentationPublic: deletes the time queue structure and allocated content.
Definition at line 149 of file time_queue.c.
Public: get last stored time pointer for given key.
Examples
time_queue_get(queue, "/unset/key") => NULL time_queue_get(queue, "/existing/key") => pointer to: 1412074060579654
Definition at line 110 of file time_queue.c.
Internal: generates a djb2 hash.
Examples
time_queue_hash('hello world') => 13876786532495509697
Definition at line 21 of file time_queue.c.
Public: instantiates a new time queue, free it with time_queue_delete.
Examples
time_queue_new(10, 42) => time_queue*
Definition at line 42 of file time_queue.c.
Internal: checks if the given key overflows the quota.
Examples
time_queue* queue = time_queue_new(10, 42); time_queue_set(queue, "/var/log/lol"); sleep(1); time_queue_overflows(queue, "/var/log/lol", 880); => 1
Definition at line 137 of file time_queue.c.
Public: set a time queue key to current time.
Examples
time_queue_set(queue, "/var/log/blah.log")
Definition at line 75 of file time_queue.c.
Internal: get the time.
Definition at line 60 of file time_queue.c.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4