/*
   "cache.h" - part of "RAGMAAN, een anagrammengenerator"

   Copyright (C) 1999 Raymond Zandbergen

   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.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   The maintainer of this program is Raymond Zandbergen (ray@wirehub.nl)
 */

#ifndef	CACHE_H
#define	CACHE_H
#define	CACHE_DEPTH	(5)
#define	CACHE_SIZE	(3)

extern int sync_cache_flag;
/* forces cache_depth to 0 at the next miss */

#include "ragmaan.h"		/* get anagram_set_t typedef */

extern anagram_set_t *get_working_set (char *target);

/*
 * gets a working set for a given target
 *      if target is found in the cache, it is reported in the cache_hit field
 *      if not, an appropriate cache slot is (re-)used & initialised
 */

extern void cache_init (void);

/*
 * sets up cache
 */

extern void set_init (anagram_set_t * p);

/*
 * initialises an anagram set
 */

extern void cache_flush (void);

/*
 * same as cache_init, without the memory allocation
 * needed when the cached data becomes invalid, e.g. after
 * loading a new database
 */

extern void cache_stats (char *, int);

/*
 * puts some nice statistics into a character buffer of specified size
 */

#endif
