SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
589 stars 254 forks source link

Memcached not works #3516

Closed PortaMx closed 8 years ago

PortaMx commented 8 years ago

I use memcached (not memcache) on a windows server, but that don't work. The cache is detected, but nothing is stored. My own routines they I have written for our Portal mod works very well. Anyone have tested that?

jdarwood007 commented 8 years ago

There was a patch a few days ago that resolved memcache issues. Please test on the latest git revision

PortaMx commented 8 years ago

Don't work .. memcached is detected but he store nothing .. The caching routines a very ugly .. I don't understand not wy SMF that not make like the database function array .. I have that made and all cache types are supported and works. So I think, I implement my own caching code .. faster and simpler ;-)

jdarwood007 commented 8 years ago

How are you detecting it isn't storing anything? When I patched it, I added to the debug output to better detect hits and misses. Look for cache misses to find out if it isn't caching data.

Here is mine showing hits working

screen shot 2016-07-04 at 1 18 51 pm
PortaMx commented 8 years ago

I think, we don't talk about the same .. I have memcached installed, not memcache .. that is not the same .. and memcached dont work in SMF, but it's work with mine cache service. 2 screenshots they i made in the memcached.php tool ... memcached-1 memcached-2

PortaMx commented 8 years ago

Well .. I found the solution .. SMF MUST have a host for memcached .. but .. that is not a must !! If no host given, allways the localhost is used, so you can remove the check if this given !

jdarwood007 commented 8 years ago

SMF treats them both the same. A host should always be specified when using it.

PortaMx commented 8 years ago

One point why my memcached not works (a windows specific probem? I don't known)

this: switch ($cache_accelerator) { case 'memcache':

must change to: switch ($cache_accelerator) { case 'memcache': case 'memcached':

Now it works also on a windows system with a local memcached service

jdarwood007 commented 8 years ago

memcached is not a valid cache setting. You should specify memcache and SMF will pick the right one.

PortaMx commented 8 years ago

Whats smf has deteted:

Settings.php: ` ########## Cache Info ########## /**

jdarwood007 commented 8 years ago

Yes, as noted in the comment, it expects it to be called "memcache". This is what the code expects as well.

jdarwood007 commented 8 years ago

I think I see the problem now. SMF Admin GUI interface expects and saves it as "memcached", but the comments and code notes it should be "memcache".

Since specifying the caching accelerator is new in SMF 2.1 (2.0 would auto-select it), I think we can go ahead and fix one or the other. The GUI seems to be the simple fix.

PortaMx commented 8 years ago

Well .. a other point .. xCache is dead .. not more supported, can be dropped I think. I have rewritten the cache function completely .. to many overhead on each get/put cache in a case list. I need the case only on first load and create in each a function for get/put/clear the cache, There after the function is called directly .. very fast ;-)

cache

PortaMx commented 8 years ago

I found a lot of : (doublepoints) in the cachefilename .. that give many trouble, because that is not a legal char on any filesystem (used in cachelevel 3 I think)

jdarwood007 commented 8 years ago

: is a legal character far as I know.

https://github.com/memcached/memcached/blob/master/doc/protocol.txt

Keys

Data stored by memcached is identified with the help of a key. A key is a text string which should uniquely identify the data for clients that are interested in storing and retrieving it. Currently the length limit of a key is set at 250 characters (of course, normally clients wouldn't need to use such long keys); the key must not include control characters or whitespace.

PortaMx commented 8 years ago

for a File ? Never .. not on Windows not on Linux

jdarwood007 commented 8 years ago

File based cache yes it is invalid. The file based cache can fix that though by subbing out illegal characters as needed.

PortaMx commented 8 years ago

yupp .. simple replace these Chars with a - , _ or # I have used a -

jdarwood007 commented 8 years ago

You should open this as a separate issue or push a PR that fixes this for the file based caching issue.

PortaMx commented 8 years ago

Oh no, no .. I never more push a pr on simplemachine, I push only corrections and new functions on my own Forum Repository ;-)

The only thing what I do for SMF .. if I find a bug, I do post it here .. not more, not less. And what makes SMF so, I do not care ...