FreeBSD/contrib/subversion/subversion/libsvn_fs_x/caching.c
/* Sets *CACHE_P to cache instance based on provided options.
 * Creates memcache if MEMCACHE is not NULL. Creates membuffer cache if
 * MEMBUFFER is not NULL. Fallbacks to inprocess cache if MEMCACHE and
 * MEMBUFFER are NULL and pages is non-zero.  Sets *CACHE_P to NULL
 * otherwise.  Use the given PRIORITY class for the new cache.  If it
 * is 0, then use the default priority class.
 *
 * Unless NO_HANDLER is true, register an error handler that reports errors
 * as warnings to the FS warning callback.
 *
 * Cache is allocated in RESULT_POOL, temporaries in SCRATCH_POOL.
 * */
Sets *CACHE_P to cache instance based on provided options.
Creates memcache if MEMCACHE is not NULL. Creates membuffer cache if
MEMBUFFER is not NULL. Fallbacks to inprocess cache if MEMCACHE and
MEMBUFFER are NULL and pages is non-zero.  Sets *CACHE_P to NULL
otherwise.  Use the given PRIORITY class for the new cache.  If it
is 0, then use the default priority class.

Unless NO_HANDLER is true, register an error handler that reports errors
as warnings to the FS warning callback.

Cache is allocated in RESULT_POOL, temporaries in SCRATCH_POOL.
Sets * CACHE_P to cache instance based on provided options . Creates memcache if MEMCACHE is not NULL . Creates membuffer cache if MEMBUFFER is not NULL . Fallbacks to inprocess cache if MEMCACHE and MEMBUFFER are NULL and pages is non - zero . Sets * CACHE_P to NULL otherwise . Use the given PRIORITY class for the new cache . If it is 0 then use the default priority class . Unless NO_HANDLER is true register an error handler that reports errors as warnings to the FS warning callback . Cache is allocated in RESULT_POOL temporaries in SCRATCH_POOL .
static svn_error_t *
create_cache(svn_cache__t **cache_p,
             svn_memcache_t *memcache,
             svn_membuffer_t *membuffer,
             apr_int64_t pages,
             apr_int64_t items_per_page,
             svn_cache__serialize_func_t serializer,
             svn_cache__deserialize_func_t deserializer,
             apr_ssize_t klen,
             const char *prefix,
             apr_uint32_t priority,
             svn_fs_t *fs,
             svn_boolean_t no_handler,
             apr_pool_t *result_pool,
             apr_pool_t *scratch_pool)
{
  svn_cache__error_handler_t error_handler = no_handler
                                           ? NULL
                                           : warn_and_fail_on_cache_errors;
  if (priority == 0)
    priority = SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY;
  if (memcache)
    {
      SVN_ERR(svn_cache__create_memcache(cache_p, memcache,
                                         serializer, deserializer, klen,
                                         prefix, result_pool));
      error_handler = no_handler
                    ? NULL
                    : warn_and_continue_on_cache_errors;
    }
  else if (membuffer)
    {
      SVN_ERR(svn_cache__create_membuffer_cache(
                cache_p, membuffer, serializer, deserializer,
                klen, prefix, priority, FALSE, result_pool, scratch_pool));
    }
  else if (pages)
    {
      SVN_ERR(svn_cache__create_inprocess(
                cache_p, serializer, deserializer, klen, pages,
                items_per_page, FALSE, prefix, result_pool));
    }
  else
    {
      *cache_p = NULL;
    }
  SVN_ERR(init_callbacks(*cache_p, fs, error_handler, result_pool));
  return SVN_NO_ERROR;
}
static svn_error_t * create_cache ( svn_cache__t * * cache_p , svn_memcache_t * memcache , svn_membuffer_t * membuffer , apr_int64_t pages , apr_int64_t items_per_page , svn_cache__serialize_func_t serializer , svn_cache__deserialize_func_t deserializer , apr_ssize_t klen , const char * prefix , apr_uint32_t priority , svn_fs_t * fs , svn_boolean_t no_handler , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_cache__error_handler_t error_handler = no_handler ? NULL : warn_and_fail_on_cache_errors ; if ( priority == 0 ) priority = SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY ; if ( memcache ) { SVN_ERR ( svn_cache__create_memcache ( cache_p , memcache , serializer , deserializer , klen , prefix , result_pool ) ) ; error_handler = no_handler ? NULL : warn_and_continue_on_cache_errors ; } else if ( membuffer ) { SVN_ERR ( svn_cache__create_membuffer_cache ( cache_p , membuffer , serializer , deserializer , klen , prefix , priority , FALSE , result_pool , scratch_pool ) ) ; } else if ( pages ) { SVN_ERR ( svn_cache__create_inprocess ( cache_p , serializer , deserializer , klen , pages , items_per_page , FALSE , prefix , result_pool ) ) ; } else { * cache_p = NULL ; } SVN_ERR ( init_callbacks ( * cache_p , fs , error_handler , result_pool ) ) ; return SVN_NO_ERROR ; }
Sets *CACHE_P to cache instance based on provided options.
Sets * CACHE_P to cache instance based on provided options .