Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUserCache.php
| Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) { | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| $chunk); | $chunk); | ||||
| } | } | ||||
| unset($unguarded); | unset($unguarded); | ||||
| } | } | ||||
| public static function clearCache($key, $user_phid) { | public static function clearCache($key, $user_phid) { | ||||
| return self::clearCaches($key, array($user_phid)); | |||||
| } | |||||
| public static function clearCaches($key, array $user_phids) { | |||||
| if (PhabricatorEnv::isReadOnly()) { | if (PhabricatorEnv::isReadOnly()) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (!$user_phids) { | |||||
| return; | |||||
| } | |||||
| $table = new self(); | $table = new self(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'DELETE FROM %T WHERE cacheIndex = %s AND userPHID = %s', | 'DELETE FROM %T WHERE cacheIndex = %s AND userPHID IN (%Ls)', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| PhabricatorHash::digestForIndex($key), | PhabricatorHash::digestForIndex($key), | ||||
| $user_phid); | $user_phids); | ||||
| unset($unguarded); | unset($unguarded); | ||||
| } | } | ||||
| public static function clearCacheForAllUsers($key) { | public static function clearCacheForAllUsers($key) { | ||||
| if (PhabricatorEnv::isReadOnly()) { | if (PhabricatorEnv::isReadOnly()) { | ||||
| return; | return; | ||||
| } | } | ||||
| $table = new self(); | $table = new self(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| Show All 12 Lines | |||||