/*****************************************************************
 * gmerlin - a general purpose multimedia framework and applications
 *
 * Copyright (c) 2001 - 2012 Members of the Gmerlin project
 * gmerlin-general@lists.sourceforge.net
 * http://gmerlin.sourceforge.net
 *
 * 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, see <http://www.gnu.org/licenses/>.
 * *****************************************************************/

typedef struct bg_object_cache_s bg_object_cache_t;

/* The value is only valid until the next call to any cache function */

const gavl_value_t * bg_object_cache_get_max_age(bg_object_cache_t * cache,
                                                 const char * id, int64_t age);

const gavl_value_t * bg_object_cache_get_min_mtime(bg_object_cache_t * cache,
                                                   const char * id, int64_t mtime);

const gavl_value_t * bg_object_cache_get(bg_object_cache_t * cache, const char * id, int64_t * mtime);

void bg_object_cache_done_get(bg_object_cache_t * cache);

void bg_object_cache_delete(bg_object_cache_t * cache, const char * id);

void bg_object_cache_put_nocopy(bg_object_cache_t * cache, const char * id, gavl_value_t * val, int64_t mtime);
void bg_object_cache_put(bg_object_cache_t * cache, const char * id, const gavl_value_t * val, int64_t mtime);

bg_object_cache_t * bg_object_cache_create(int max_disk_cache_size,
                                           int max_memory_cache_size,
                                           const char * directory);

void bg_object_cache_destroy(bg_object_cache_t * cache);
