Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/include/private/svn_cache.h  view on Meta::CPAN

svn_cache__create_inprocess(svn_cache__t **cache_p,
                            svn_cache__serialize_func_t serialize_func,
                            svn_cache__deserialize_func_t deserialize_func,
                            apr_ssize_t klen,
                            apr_int64_t pages,
                            apr_int64_t items_per_page,
                            svn_boolean_t thread_safe,
                            const char *id,
                            apr_pool_t *pool);

/**
 * Creates a new cache in @a *cache_p, communicating to a memcached
 * process via @a memcache.  The elements in the cache will be indexed
 * by keys of length @a klen, which may be APR_HASH_KEY_STRING if they
 * are strings.  Values will be serialized for memcached using @a
 * serialize_func and deserialized using @a deserialize_func.  Because
 * the same memcached server may cache many different kinds of values,
 * @a prefix should be specified to differentiate this cache from
 * other caches.  @a *cache_p will be allocated in @a result_pool.
 *
 * If @a deserialize_func is NULL, then the data is returned as an
 * svn_stringbuf_t; if @a serialize_func is NULL, then the data is
 * assumed to be an svn_stringbuf_t.
 *
 * These caches are always thread safe.
 *
 * These caches do not support svn_cache__iter.
 *
 * If Subversion was not built with apr_memcache support, always
 * raises SVN_ERR_NO_APR_MEMCACHE.
 */
svn_error_t *
svn_cache__create_memcache(svn_cache__t **cache_p,
                           svn_memcache_t *memcache,
                           svn_cache__serialize_func_t serialize_func,
                           svn_cache__deserialize_func_t deserialize_func,
                           apr_ssize_t klen,
                           const char *prefix,
                           apr_pool_t *result_pool);

/**
 * Given @a config, returns an APR memcached interface in @a
 * *memcache_p allocated in @a result_pool if @a config contains entries in
 * the SVN_CACHE_CONFIG_CATEGORY_MEMCACHED_SERVERS section describing
 * memcached servers; otherwise, sets @a *memcache_p to NULL.
 *
 * If Subversion was not built with apr_memcache_support, then raises
 * SVN_ERR_NO_APR_MEMCACHE if and only if @a config is configured to
 * use memcache.
 */
svn_error_t *
svn_cache__make_memcache_from_config(svn_memcache_t **memcache_p,
                                     svn_config_t *config,
                                     apr_pool_t *result_pool);

/**
 * Creates a new membuffer cache object in @a *cache. It will contain
 * up to @a total_size bytes of data, using @a directory_size bytes
 * for index information and the remainder for serialized objects.
 *
 * Since each index entry is about 50 bytes long, 1 to 10 percent of
 * the @a total_size should be allocated to the @a directory_size,
 * depending on the average serialized object size. Higher percentages
 * will generally result in higher hit rates and reduced conflict
 * resolution overhead.
 *
 * The cache will be split into @a segment_count segments of equal size.
 * A higher number reduces lock contention but also limits the maximum
 * cachable item size.  If it is not a power of two, it will be rounded
 * down to next lower power of two. Also, there is an implementation
 * specific upper limit and the setting will be capped there automatically.
 * If the number is 0, a default will be derived from @a total_size.
 *
 * If access to the resulting cache object is guaranteed to be serialized,
 * @a thread_safe may be set to @c FALSE for maximum performance.
 *
 * There is no limit on the number of threads reading a given cache segment
 * concurrently.  Writes, however, need an exclusive lock on the respective
 * segment.  @a allow_blocking_writes controls contention is handled here.
 * If set to TRUE, writes will wait until the lock becomes available, i.e.
 * reads should be short.  If set to FALSE, write attempts will be ignored
 * (no data being written to the cache) if some reader or another writer
 * currently holds the segment lock.
 *
 * Allocations will be made in @a result_pool, in particular the data buffers.
 */
svn_error_t *
svn_cache__membuffer_cache_create(svn_membuffer_t **cache,
                                  apr_size_t total_size,
                                  apr_size_t directory_size,
                                  apr_size_t segment_count,
                                  svn_boolean_t thread_safe,
                                  svn_boolean_t allow_blocking_writes,
                                  apr_pool_t *result_pool);

/**
 * Creates a new cache in @a *cache_p, storing the data in a potentially
 * shared @a membuffer object.  The elements in the cache will be indexed
 * by keys of length @a klen, which may be APR_HASH_KEY_STRING if they
 * are strings.  Values will be serialized for the memcache using @a
 * serialize_func and deserialized using @a deserialize_func.  Because
 * the same memcache object may cache many different kinds of values
 * form multiple caches, @a prefix should be specified to differentiate
 * this cache from other caches.  @a *cache_p will be allocated in @a result_pool.
 *
 * If @a deserialize_func is NULL, then the data is returned as an
 * svn_stringbuf_t; if @a serialize_func is NULL, then the data is
 * assumed to be an svn_stringbuf_t.
 *
 * If @a thread_safe is true, and APR is compiled with threads, all
 * accesses to the cache will be protected with a mutex, if the shared
 * @a memcache has also been created with thread_safe flag set.
 *
 * These caches do not support svn_cache__iter.
 */
svn_error_t *
svn_cache__create_membuffer_cache(svn_cache__t **cache_p,
                                  svn_membuffer_t *membuffer,
                                  svn_cache__serialize_func_t serialize,
                                  svn_cache__deserialize_func_t deserialize,
                                  apr_ssize_t klen,
                                  const char *prefix,
                                  svn_boolean_t thread_safe,



( run in 0.873 second using v1.01-cache-2.11-cpan-140bd7fdf52 )