- // Set the cache unless it is currently salted with the value "PURGED".
- // Using add() handles this except it also is a no-op in that case where
- // the current value is not "latest" but $val is, so use CAS in that case.
- if ( !$this->memCache->add( $key, $val, $ttl ) && !empty( $val['latest'] ) ) {
- $this->memCache->merge(
- $key,
- function ( BagOStuff $cache, $key, $cValue ) use ( $val ) {
- return ( is_array( $cValue ) && empty( $cValue['latest'] ) )
- ? $val // update the stat cache with the lastest info
- : false; // do nothing (cache is salted or some error happened)
- },
- $ttl,
- 1
- );
- }
+ // Set the cache unless it is currently salted.
+ $this->memCache->set( $key, $val, $ttl );