Commit graph

25 commits

Author SHA1 Message Date
Ori Livneh
8c313fe58b Fix typo: exipration => expiration
Change-Id: I73d19cfeed0596b66e16e4c383b3658594c211e3
2012-11-15 01:47:54 -08:00
Aaron Schulz
29ab088e2f Merge "Stop php strict error warnings from MemcachedClient::_flush_read_buffer()" 2012-10-23 18:44:48 +00:00
umherirrender
c66d868e6d Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I166a171c196f4c2c75886be12f913ffa9a4a35ad
2012-10-19 22:10:42 +02:00
awjrichards
b7a9b77199 Stop php strict error warnings from MemcachedClient::_flush_read_buffer()
Change-Id: I467f293e3be30c7019111a368491c1a3a6a2af08
2012-10-12 11:46:41 -07:00
Tim Starling
76c3ab462f Memcached PHP client improvements
* When there is a read error, close the socket and mark the server dead,
  instead of continuing to send requests through it, causing a protocol
  violation.
* Also check for write errors.
* Increase the default stream and connect timeouts from 100ms to 500ms.
* Remove the commented-out _safe_fwrite() code that I wrote in 2005,
  that PHP bug is fixed now, so writes can be handled the same way as
  reads.
* Fix E_STRICT errors in get_multi() due to a resource being used as an
  array index.
* For performance, flush the read buffer less often (only on persistent
  connect).
* Move the fread() loop from _load_items() into its own new function.
* Be stricter about stripping expected newlines, don't just run trim() on
  everything.
* Make MemCachedClientforWiki into a simple alias since the distinction
  with MWMemcached was lost many years ago. We even renamed the class
  "MWMemcached".
* Remove vim modeline made incorrect by 19d6293 (Nov 2009).

Change-Id: I81de31049b87038999e37054d8d174a782c78a68
2012-08-03 21:24:55 +10:00
Antoine Musso
bbf703c4fa memcached: better error messaging
MemcachedClient output a generic error message: "Error parsing memcached
response\n" whenever it is not able to read from the socket. It is also
lacking the remote peer it is reading from.

This patch add a new message when fgets( <socket> ) return false, which
means we could not read from the file pointer. It also get the stream
remote name for debugging purposes.

Change-Id: I9b8a25a03af0d730aa3b4830a44b1ea739343274
2012-08-01 16:33:26 +02:00
Aaron Schulz
1caa1d7361 Revert "memcached: better error messaging"
This always issues PHP notices when the code is hit.

This reverts commit fe6da52a11
2012-07-25 19:28:08 +00:00
Antoine Musso
fe6da52a11 memcached: better error messaging
MemcachedClient output a generic error message: "Error parsing memcached
response\n" whenever it is not able to read from the socket. It is also
lacking the remote peer it is reading form.

This patch add a new message when fgets( <socket> ) return false and
attempt to get the remote peer address / port to append to the error
message. Might help us find out which memcached server is wild.

Change-Id: If918e824970aaa8231078e42fd28d31e8dd4e319
2012-07-13 18:20:00 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Tim Starling
3c62077fe2 Implemented a wrapper for the memcached PECL client
* Introduced a common base class for the two memcached clients, called
  MemcachedBagOStuff.
* Moved the expiry time normalisation from MemcachedClient.php to
  MemcachedBagOStuff since libmemcached needs the same workaround.

Change-Id: I507d4ec5a7fd863ae64a94f2c453981f9f03746c
2012-05-15 10:19:41 +10:00
Alexandre Emsenhuber
d7f3f6be14 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ib21f42166ae0841e04c8af4fdcf59c0fa06f1738
2012-05-02 10:51:15 +02:00
Aaron
bb5e589600 Made delete() return True for NOT_FOUND memcached responses.
Change-Id: Ia1ec62721a3e42dd7a5bd21974e922d500d3f501
2012-04-27 16:41:20 -07:00
Antoine Musso
ad240ebc22 group memcached debug logs
When enabling memcached debug logs ($wgMemCachedDebug), they are
unconditionally sent to the main $wgDebugLogFile.  This patch make it
possible to sent thoses specific log to an alternate file by setting
$wgDebugLogGroups['memcached']

Change-Id: I85d8ab92471ce3c31f8168dae83fe91e95e18dce
2012-04-19 15:50:44 +02:00
Sam Reed
c27fbf5330 Trim trailing whitespace
Add/improve documentation

Explicitly define a few variables

Change-Id: If0017770a0a47f8f6be178b5bde8ae6691f74b6a
2012-03-21 15:47:05 -07:00
Roan Kattouw
311200ee2c Revert r114067, r114071, r114075, r114079, r114081, r114082, r114084, r114086, r114088, r114089, r114101, r114118, r114137, r114147, r114164, r114172, r114175, r114180, r114208, r114209, r114215, r114219, r114226, r114321, r114322.
This reverts the SpecialCachedPage and formatDuration sagas, with some collateral damage here and there. All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
2012-03-20 23:03:59 +00:00
Sam Reed
a2dc33a5a3 Trim trailing whitespace
Add/improve documentation

Explicitly define a few variables
2012-03-17 22:52:54 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
dd6062e75e Bug 13759 - memcached predefined hashes
Patch by Zac Bristow

Half of the patch was already applied. Updated documentation to match
2011-11-19 20:01:33 +00:00
Roan Kattouw
f8024445dd Per Domas, reinstate <1e9 check that was dropped in r94199. Also document what these checks are all about in more detail. 2011-10-06 14:07:57 +00:00
Aaron Schulz
a6999018e5 Added lock/unlock function stubs. Fixes:
PHP fatal error in /usr/local/apache/common-local/php-1.18/includes/objectcache/MemcachedPhpBagOStuff.php line 91: 
Call to undefined method MemCachedClientforWiki::lock()
2011-09-21 20:25:58 +00:00
Roan Kattouw
e877e8f5e0 Merge r93797 to trunk, in a somewhat modified form: clamp expiries for memcached to 30 days, higher values give trouble apparently 2011-08-10 21:15:57 +00:00
Sam Reed
bccd879a46 Add/tweak/update documentation and add some explicit defintions with type descriptions 2011-03-25 10:56:54 +00:00
Platonides
8f0a89efcb Reorder so that wfProfileOut() is the last sentence before the return. 2011-03-06 23:29:29 +00:00
Tim Starling
be76d86932 * Rewrote ObjectCache.php to conform to the modern coding style, and to be less convoluted about how CACHE_ANYTHING and CACHE_ACCEL are resolved. Moved most functionality to static members of a new ObjectCache class.
* Moved the global functions to GlobalFunctions.php, where they are now just convenience wrappers. Made them return non-references. Updated callers (none found in extensions). 
* Added an advanced configuration method, $wgObjectCaches, which allows a lot more detail in the object cache configuration than $wgMainCacheType. 
* Made all object cache classes derive from BagOStuff. 
* Split the MWMemcached class into a generic client class and a MediaWiki-specific wrapper class. The wrapper class presents a simple BagOStuff interface to calling code, hiding memcached client internals, and will simplify the task of supporting the PECL extension.
* Added some extra constructor parameters to MWMemcached, configurable via $wgObjectCaches.
* Removed the *_multi() methods from BagOStuff, my grepping indicates that they are not used.
* Rewrote FakeMemCachedClient as a BagOStuff subclass, called EmptyBagOStuff.
* Added an optional "server" parameter to SQLBagOStuff. This allows the server holding the objectcache table to be different from the server holding the core DB.
* Added MultiWriteBagOStuff: a cache class which writes to multiple locations, and reads from them in a defined fallback sequence. This can be used to extend the cache space by adding disk-backed storage to existing in-memory caches.
* Made MWMemcached::get() return false on failure instead of null, to match the BagOStuff documentation and the other BagOStuff subclasses. Anything that was relying on it returning null would have already been broken with SqlBagOStuff.
* Fixed a bug in the memcached client causing keys with spaces or line breaks in them to break the memcached protocol, injecting arbitrary commands or parameters. Since the PECL client apparently also has this flaw, I implemented the fix in the wrapper class.
* Renamed BagOStuff::set_debug() to setDebug(), since we aren't emulating the memcached client anymore
* Fixed spelling error in MWMemcached: persistant -> persistent
2011-03-03 09:37:37 +00:00
Tim Starling
d3f36ffd4d More renames and splits for objectcache reorganisation. 2011-03-03 04:48:14 +00:00
Renamed from includes/memcached-client.php (Browse further)