Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72164858
PhabricatorUserCacheType.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 15, 02:07
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Jul 17, 02:07 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
19041294
Attached To
rPH Phabricator
PhabricatorUserCacheType.php
View Options
<?php
abstract
class
PhabricatorUserCacheType
extends
Phobject
{
final
public
function
getViewer
()
{
return
PhabricatorUser
::
getOmnipotentUser
();
}
public
function
getAutoloadKeys
()
{
return
array
();
}
public
function
canManageKey
(
$key
)
{
return
false
;
}
public
function
getDefaultValue
()
{
return
array
();
}
public
function
getValueFromStorage
(
$value
)
{
return
phutil_json_decode
(
$value
);
}
public
function
getValueForStorage
(
$value
)
{
return
phutil_json_encode
(
$value
);
}
public
function
newValueForUsers
(
$key
,
array
$users
)
{
return
array
();
}
final
public
function
getUserCacheType
()
{
return
$this
->
getPhobjectClassConstant
(
'CACHETYPE'
);
}
public
static
function
getAllCacheTypes
()
{
return
id
(
new
PhutilClassMapQuery
())
->
setAncestorClass
(
__CLASS__
)
->
setUniqueMethod
(
'getUserCacheType'
)
->
execute
();
}
public
static
function
getCacheTypeForKey
(
$key
)
{
$all
=
self
::
getAllCacheTypes
();
foreach
(
$all
as
$type
)
{
if
(
$type
->
canManageKey
(
$key
))
{
return
$type
;
}
}
return
null
;
}
public
static
function
requireCacheTypeForKey
(
$key
)
{
$type
=
self
::
getCacheTypeForKey
(
$key
);
if
(!
$type
)
{
throw
new
Exception
(
pht
(
'Failed to load UserCacheType to manage key "%s". This cache type '
.
'is required.'
,
$key
));
}
return
$type
;
}
}
Event Timeline
Log In to Comment