Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14833996
D13324.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13324.diff
View Options
diff --git a/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php b/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
--- a/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
+++ b/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
@@ -5,6 +5,7 @@
const KEY_ALL = 'spaces.all';
const KEY_DEFAULT = 'spaces.default';
+ const KEY_VIEWER = 'spaces.viewer';
private $ids;
private $phids;
@@ -141,17 +142,25 @@
}
public static function getViewerSpaces(PhabricatorUser $viewer) {
- $spaces = self::getAllSpaces();
+ $cache = PhabricatorCaches::getRequestCache();
+ $cache_key = self::KEY_VIEWER.'('.$viewer->getPHID().')';
- $result = array();
- foreach ($spaces as $key => $space) {
- $can_see = PhabricatorPolicyFilter::hasCapability(
- $viewer,
- $space,
- PhabricatorPolicyCapability::CAN_VIEW);
- if ($can_see) {
- $result[$key] = $space;
+ $result = $cache->getKey($cache_key);
+ if ($result === null) {
+ $spaces = self::getAllSpaces();
+
+ $result = array();
+ foreach ($spaces as $key => $space) {
+ $can_see = PhabricatorPolicyFilter::hasCapability(
+ $viewer,
+ $space,
+ PhabricatorPolicyCapability::CAN_VIEW);
+ if ($can_see) {
+ $result[$key] = $space;
+ }
}
+
+ $cache->setKey($cache_key, $result);
}
return $result;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 1:22 PM (16 h, 2 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7078623
Default Alt Text
D13324.diff (1 KB)
Attached To
Mode
D13324: Cache viewer spaces
Attached
Detach File
Event Timeline
Log In to Comment