• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Few questions about xenforo caching

Moscato

Active member
#1
#1
What exactly is cached with
$config['cache']['enabled'] = true;
enabled?

#2 How is that different from BD cache?
https://xenforo.com/community/resources/bd-cache.2763/

#3
Xenforo can use APC cache, memcached, or file cache

I keep hearing APC has issues with 5.5+ so I'm going to cut that out as an option

That leaves memcached and filecache (am I missing anything? Does it support redis?)

Memcached is clearly faster than standard file cache because file cache is on disk while memcached is in ram

What I would like to know, is memcached faster than tmpfs filecache?
I'm primarily used to a wordpress environment and people consistently say tmpfs is faster than using memcached as a backend for pagecaching

If not, on a single box, why would you use memcached?
 

Brogan

XenForo moderator
Staff member
#2
Caching is explained here: https://xenforo.com/help/cache/

Both frontend and backend are required.
The frontend enables the cache, the backend defines the type.

Opcache is for caching PHP's opcodes.
The config.php cache entries are for caching data.

Of the caching methods, I would recommend Memcached. If you're already using caching, you should specifically opt-in to session caching as well:
$config['cache']['cacheSessions'] = true;
With Memcached, cached data will be expunged when it expires (after lack of use) or when the memory is full (in a least-recently-used fashion).
 

Moscato

Active member
#3
Caching is explained here: https://xenforo.com/help/cache/

Both frontend and backend are required.
The frontend enables the cache, the backend defines the type.

Opcache is for caching PHP's opcodes.
The config.php cache entries are for caching data.

Of the caching methods, I would recommend Memcached. If you're already using caching, you should specifically opt-in to session caching as well:
$config['cache']['cacheSessions'] = true;
With Memcached, cached data will be expunged when it expires (after lack of use) or when the memory is full (in a least-recently-used fashion).
Are you suggesting the file cache method does NOT clear out old expired data?

At this exact moment, I'm setup as:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
$config['cache']['cacheSessions'] = true;
$config['cache']['backend'] = 'File';
$config['cache']['backendOptions'] ['cache_dir'] = '/srv/http/techraptor/community/file_cache';

that filecache is sitting on tmpfs

http://we-love-php.blogspot.com/2013/02/php-caching-shm-apc-memcache-mysql-file-cache.html
Reading this is what made me wonder about it, as tmpfs has been reported to being 30 times faster than memcached
shm is another term for tmpfs

I still am a bit confused as to what actually is being cached
 

Fred.

Well-known member
#4
Of the caching methods, I would recommend Memcached. If you're already using caching, you should specifically opt-in to session caching as well:
$config['cache']['cacheSessions'] = true;
With Memcached, cached data will be expunged when it expires (after lack of use) or when the memory is full (in a least-recently-used fashion).
I'm using Memcached, or Libmemcached to be more specific.
When I enable cacheSessions I just get a white page. Without it it works perfect.
Any idea?
 

Brogan

XenForo moderator
Staff member
#5
I seem to recall something about Libmemcached, my memory's a bit hazy though.

It might be worth doing a search.
 

Marcus

Well-known member
#8
I use the pecl memcached extension (not the pecl memcache extension) and just entered "Libmemcached" as the backend cache within config.php, and it works great with sessions, too. I did not have to change any values in my configuration.

Usually names with a "d" at the end are a sign that these programs work like a "daemon". That's not the case with this extension, it is just a newer pecl client extension for memcache. When I installed it on my server, libmemcached was also installed automatically.
 

Marcus

Well-known member
#10
I guess $config['cache']['enabled'] = false; will globally disable any cache (frontend and backend). I don't know much more about how cache system works unfortunately.