Commit graph

17 commits

Author SHA1 Message Date
Kunal Mehta
02b18ba4cd Fix/suppress phan errors related to arrays (#11)
Change-Id: Ie5c05fbc88c51d493bc1462005d2f8dde5f72101
2019-04-07 16:27:02 +00:00
Aaron Schulz
962495b17a objectcache: merge getWithToken() into doGet() for simplicity
Change-Id: I581f866521e1086ca350973d9cdeff6656f48fe8
2019-03-27 13:03:25 -07:00
Aaron Schulz
f00df01316 objectcache: remove redundant merge() definitions
Change-Id: Ide24dd395b300f8d747b2be307dbbad08f6b221d
2019-03-27 18:13:40 +00:00
Aaron Schulz
8c92400909 objectcache: optimize merge()/incr() for WinCacheBagOStuff
Do not hold WinCache locks during merge() callbacks, as that
could be seconds of being blocked (and some callers do not
expect indefinite blocking). Make merge() use the CAS method
which only uses wincache_lock() after callback runs in very
tight getWithToken()/set() cycle.

Make incr() use wincache_lock() since it also is very tight
doGet()/set() cycle with negligable work in between.

Change-Id: I0dde6f62c7e3d4a802470c181570ad4353d0e6ea
2019-03-20 20:02:18 +00:00
Aaron Schulz
fea9ebbd6f objectcache: make the BagOStuff::add() operation more atomic for WinCache
Change-Id: I285ed9a7d0894adfe29b0bdc106b7518f655ba45
2019-03-15 00:38:18 +00:00
Aaron Schulz
5dd409cd38 objectcache: add $flags argument to BagOStuff::delete()
This makes it consistent with set() and merge(). Also, one subclass
was already using the field in this manner.

Clean up the code related to WRITE_SYNC in SqlBagOStuff.

Change-Id: I0fb84f4475311889507d3ef98afd4476fb81174f
2019-03-07 13:15:29 -08:00
Juan Osorio
7572c9097a objectcache: Fixes WinCache increment losing TTL.
WinCache incr function adds a number to the value of a key, but
in the process loses the Time To Live of the cache entry. This
fixes such bug.

Bug: T211914
Change-Id: I02889e63b95188b8d5123a9788a020ca3aa7d1b1
2018-12-13 14:36:06 -08:00
Juan Osorio
5bae617f0f objectcache: Fix WinCache keys longer than 150 chars
Adds MD5 hashing to the generation of keys for WinCache. This
fixes the issue of keys (e.g. sub-headings) longer than 150
characters.

Bug: T210794
Change-Id: Ieabf6b014a0660198077a23760a05564bf268535
2018-12-12 18:48:21 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
Aaron Schulz
d1b53e32c7 objectcache: Remove broken cas() method from WinCacheBagOStuff
Bug: T120896
Change-Id: I9406a50df8e900b4fc5861c2174ba7a63a0dd765
2016-11-16 05:02:37 +00:00
Aaron Schulz
faac856f21 Fix broken wincache merge() implementation
Bug: T145664
Change-Id: I2f841779108df281e24003c586775b71aa176909
2016-09-15 04:50:25 -07:00
Kunal Mehta
4a8ae0a0b4 Use callable type-hint in a few places
Mostly places which immediately had a:
 if ( !is_callable( $callback ) ) {
  throw new Exception(...);
 }
check at the beginning of the function.

Change-Id: Ia78663b2231629010816bd1cda8814b996968d1d
2016-06-07 16:39:22 -07:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
5c8ef13306 Add WRITE_SYNC flag to BagOStuff::set()/merge()
* This blocks on writing to all replicas
  and returns false if any failed.
* This is useful if ChronologyProtector is to work across
  domains by having the writes go everywhere so that later
  reads will see them (and be local at the same time).
* Redundant doc comments were also removed.

Change-Id: I9ed098d563c64dba605e7809bc96731da3b3e79d
2015-10-22 01:44:09 +00:00
Aaron Schulz
1fa1235d32 Clean up BagOStuff::get() interface
* Callers of get() no longer have to contend with
  the annoying $casToken parameter, which is there
  but totally unusable to non-BagOStuff code.
* The default get() now delegates to doGet(),
  which callers must implement instead. They can
  ignore the overhead of generating $casToken if
  they do not implement cas(), which applies to
  callers that use the stock merge(). If cas() is
  used for merge(), then getWithToken() must be
  implemented.
* Also add BagOStuff::READ_LATEST to mergeViaCas()
  for sanity, as that missing before.
  Likewise with mergeViaLock().

Change-Id: I4efce6a9ab4b1eadd2f161dff641004a7239c516
2015-10-07 02:54:57 +00:00
Aaron Schulz
c3dec1193c Added BagOStuff READ_LATEST flag for replicated stores
Bug: T88493
Change-Id: I7ea050a2eabba635f2aadb4e33b6f8fbfb1b01a8
2015-08-04 16:03:37 -07:00
Kunal Mehta
1e3888de00 Start moving objectcache into libs/
The base BagOStuff class and some of the implementations are
not dependent on MediaWiki and can be in the libs folder.

Change-Id: I299f9abb778abc65a70461a2aff3015c02a1f04d
2015-02-25 00:22:50 -08:00
Renamed from includes/objectcache/WinCacheBagOStuff.php (Browse further)