cache_cache.h revision 0a649f5f00c3fca1b5ed74d3044313e9d69dd60b
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/* Licensed to the Apache Software Foundation (ASF) under one or more
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * contributor license agreements. See the NOTICE file distributed with
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * this work for additional information regarding copyright ownership.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * The ASF licenses this file to You under the Apache License, Version 2.0
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * (the "License"); you may not use this file except in compliance with
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * the License. You may obtain a copy of the License at
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * Unless required by applicable law or agreed to in writing, software
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * distributed under the License is distributed on an "AS IS" BASIS,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * See the License for the specific language governing permissions and
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * limitations under the License.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @brief Cache Cache Functions
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @defgroup Cache_cache Cache Functions
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @ingroup MOD_CACHE
a78048ccbdb6256da15e6b0e7e95355e480c2301ndextern "C" {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/** ADT for the cache */
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/** callback to increment the frequency of a item */
a78048ccbdb6256da15e6b0e7e95355e480c2301ndtypedef void cache_cache_inc_frequency(void*a);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/** callback to get the size of a item */
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/** callback to get the key of a item */
a78048ccbdb6256da15e6b0e7e95355e480c2301ndtypedef const char* cache_cache_get_key(void *a);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd/** callback to free an entry */
a78048ccbdb6256da15e6b0e7e95355e480c2301ndtypedef void cache_cache_free(void *a);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * initialize the cache ADT
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param max_entries the number of entries in the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param max_size the size of the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param get_pri callback to get a priority of a entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param set_pri callback to set a priority of a entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param get_pos callback to get the position of a entry in the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param set_pos callback to set the position of a entry in the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param inc_entry callback to increment the frequency of a entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param size_entry callback to get the size of a entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param key_entry callback to get the key of a entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param free_entry callback to free an entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * free up the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param c the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * find a entry in the cache, incrementing the frequency if found
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param c the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param key the key
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * insert a entry into the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param c the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param entry the entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * insert a entry into the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param c the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param entry the entry
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * pop the lowest priority item off
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param c the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @returns the entry or NULL
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * remove an item from the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param c the cache
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * @param entry the actual entry (from a find)
a78048ccbdb6256da15e6b0e7e95355e480c2301nd#endif /* !CACHE_CACHE_H */