1
0

IUserConfig.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace NCU\Config;
  8. use Generator;
  9. use NCU\Config\Exceptions\IncorrectTypeException;
  10. use NCU\Config\Exceptions\UnknownKeyException;
  11. /**
  12. * This class provides an easy way for apps to store user config in the
  13. * database.
  14. * Supports **lazy loading**
  15. *
  16. * ### What is lazy loading ?
  17. * In order to avoid loading useless user config into memory for each request,
  18. * only non-lazy values are now loaded.
  19. *
  20. * Once a value that is lazy is requested, all lazy values will be loaded.
  21. *
  22. * Similarly, some methods from this class are marked with a warning about ignoring
  23. * lazy loading. Use them wisely and only on parts of the code that are called
  24. * during specific requests or actions to avoid loading the lazy values all the time.
  25. *
  26. * @experimental 31.0.0
  27. * @since 31.0.0
  28. */
  29. interface IUserConfig {
  30. /** @since 31.0.0 */
  31. public const FLAG_SENSITIVE = 1; // value is sensitive
  32. /** @since 31.0.0 */
  33. public const FLAG_INDEXED = 2; // value should be indexed
  34. /**
  35. * Get list of all userIds with config stored in database.
  36. * If $appId is specified, will only limit the search to this value
  37. *
  38. * **WARNING:** ignore any cache and get data directly from database.
  39. *
  40. * @param string $appId optional id of app
  41. *
  42. * @return list<string> list of userIds
  43. * @since 31.0.0
  44. */
  45. public function getUserIds(string $appId = ''): array;
  46. /**
  47. * Get list of all apps that have at least one config
  48. * value related to $userId stored in database
  49. *
  50. * **WARNING:** ignore lazy filtering, all user config are loaded from database
  51. *
  52. * @param string $userId id of the user
  53. *
  54. * @return list<string> list of app ids
  55. * @since 31.0.0
  56. */
  57. public function getApps(string $userId): array;
  58. /**
  59. * Returns all keys stored in database, related to user+app.
  60. * Please note that the values are not returned.
  61. *
  62. * **WARNING:** ignore lazy filtering, all user config are loaded from database
  63. *
  64. * @param string $userId id of the user
  65. * @param string $app id of the app
  66. *
  67. * @return list<string> list of stored config keys
  68. * @since 31.0.0
  69. */
  70. public function getKeys(string $userId, string $app): array;
  71. /**
  72. * Check if a key exists in the list of stored config values.
  73. *
  74. * @param string $userId id of the user
  75. * @param string $app id of the app
  76. * @param string $key config key
  77. * @param bool $lazy search within lazy loaded config
  78. *
  79. * @return bool TRUE if key exists
  80. * @since 31.0.0
  81. */
  82. public function hasKey(string $userId, string $app, string $key, ?bool $lazy = false): bool;
  83. /**
  84. * best way to see if a value is set as sensitive (not displayed in report)
  85. *
  86. * @param string $userId id of the user
  87. * @param string $app id of the app
  88. * @param string $key config key
  89. * @param bool|null $lazy search within lazy loaded config
  90. *
  91. * @return bool TRUE if value is sensitive
  92. * @throws UnknownKeyException if config key is not known
  93. * @since 31.0.0
  94. */
  95. public function isSensitive(string $userId, string $app, string $key, ?bool $lazy = false): bool;
  96. /**
  97. * best way to see if a value is set as indexed (so it can be search)
  98. *
  99. * @see self::searchUsersByValueString()
  100. * @see self::searchUsersByValueInt()
  101. * @see self::searchUsersByValueBool()
  102. * @see self::searchUsersByValues()
  103. *
  104. * @param string $userId id of the user
  105. * @param string $app id of the app
  106. * @param string $key config key
  107. * @param bool|null $lazy search within lazy loaded config
  108. *
  109. * @return bool TRUE if value is sensitive
  110. * @throws UnknownKeyException if config key is not known
  111. * @since 31.0.0
  112. */
  113. public function isIndexed(string $userId, string $app, string $key, ?bool $lazy = false): bool;
  114. /**
  115. * Returns if the config key stored in database is lazy loaded
  116. *
  117. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  118. *
  119. * @param string $userId id of the user
  120. * @param string $app id of the app
  121. * @param string $key config key
  122. *
  123. * @return bool TRUE if config is lazy loaded
  124. * @throws UnknownKeyException if config key is not known
  125. * @see IUserConfig for details about lazy loading
  126. * @since 31.0.0
  127. */
  128. public function isLazy(string $userId, string $app, string $key): bool;
  129. /**
  130. * List all config values from an app with config key starting with $key.
  131. * Returns an array with config key as key, stored value as value.
  132. *
  133. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  134. *
  135. * @param string $userId id of the user
  136. * @param string $app id of the app
  137. * @param string $prefix config keys prefix to search, can be empty.
  138. * @param bool $filtered filter sensitive config values
  139. *
  140. * @return array<string, string|int|float|bool|array> [key => value]
  141. * @since 31.0.0
  142. */
  143. public function getValues(string $userId, string $app, string $prefix = '', bool $filtered = false): array;
  144. /**
  145. * List all config values of a user.
  146. * Returns an array with config key as key, stored value as value.
  147. *
  148. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  149. *
  150. * @param string $userId id of the user
  151. * @param bool $filtered filter sensitive config values
  152. *
  153. * @return array<string, string|int|float|bool|array> [key => value]
  154. * @since 31.0.0
  155. */
  156. public function getAllValues(string $userId, bool $filtered = false): array;
  157. /**
  158. * List all apps storing a specific config key and its stored value.
  159. * Returns an array with appId as key, stored value as value.
  160. *
  161. * @param string $userId id of the user
  162. * @param string $key config key
  163. * @param bool $lazy search within lazy loaded config
  164. * @param ValueType|null $typedAs enforce type for the returned values
  165. *
  166. * @return array<string, string|int|float|bool|array> [appId => value]
  167. * @since 31.0.0
  168. */
  169. public function getValuesByApps(string $userId, string $key, bool $lazy = false, ?ValueType $typedAs = null): array;
  170. /**
  171. * List all users storing a specific config key and its stored value.
  172. * Returns an array with userId as key, stored value as value.
  173. *
  174. * **WARNING:** no caching, generate a fresh request
  175. *
  176. * @param string $app id of the app
  177. * @param string $key config key
  178. * @param ValueType|null $typedAs enforce type for the returned values
  179. * @param array|null $userIds limit the search to a list of user ids
  180. *
  181. * @return array<string, string|int|float|bool|array> [userId => value]
  182. * @since 31.0.0
  183. */
  184. public function getValuesByUsers(string $app, string $key, ?ValueType $typedAs = null, ?array $userIds = null): array;
  185. /**
  186. * List all users storing a specific config key/value pair.
  187. * Returns a list of user ids.
  188. *
  189. * **WARNING:** no caching, generate a fresh request
  190. *
  191. * @param string $app id of the app
  192. * @param string $key config key
  193. * @param string $value config value
  194. * @param bool $caseInsensitive non-case-sensitive search, only works if $value is a string
  195. *
  196. * @return Generator<string>
  197. * @since 31.0.0
  198. */
  199. public function searchUsersByValueString(string $app, string $key, string $value, bool $caseInsensitive = false): Generator;
  200. /**
  201. * List all users storing a specific config key/value pair.
  202. * Returns a list of user ids.
  203. *
  204. * **WARNING:** no caching, generate a fresh request
  205. *
  206. * @param string $app id of the app
  207. * @param string $key config key
  208. * @param int $value config value
  209. *
  210. * @return Generator<string>
  211. * @since 31.0.0
  212. */
  213. public function searchUsersByValueInt(string $app, string $key, int $value): Generator;
  214. /**
  215. * List all users storing a specific config key/value pair.
  216. * Returns a list of user ids.
  217. *
  218. * **WARNING:** no caching, generate a fresh request
  219. *
  220. * @param string $app id of the app
  221. * @param string $key config key
  222. * @param array $values list of possible config values
  223. *
  224. * @return Generator<string>
  225. * @since 31.0.0
  226. */
  227. public function searchUsersByValues(string $app, string $key, array $values): Generator;
  228. /**
  229. * List all users storing a specific config key/value pair.
  230. * Returns a list of user ids.
  231. *
  232. * **WARNING:** no caching, generate a fresh request
  233. *
  234. * @param string $app id of the app
  235. * @param string $key config key
  236. * @param bool $value config value
  237. *
  238. * @return Generator<string>
  239. * @since 31.0.0
  240. */
  241. public function searchUsersByValueBool(string $app, string $key, bool $value): Generator;
  242. /**
  243. * Get user config assigned to a config key.
  244. * If config key is not found in database, default value is returned.
  245. * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
  246. *
  247. * @param string $userId id of the user
  248. * @param string $app id of the app
  249. * @param string $key config key
  250. * @param string $default default value
  251. * @param bool $lazy search within lazy loaded config
  252. *
  253. * @return string stored config value or $default if not set in database
  254. * @since 31.0.0
  255. * @see IUserConfig for explanation about lazy loading
  256. * @see getValueInt()
  257. * @see getValueFloat()
  258. * @see getValueBool()
  259. * @see getValueArray()
  260. */
  261. public function getValueString(string $userId, string $app, string $key, string $default = '', bool $lazy = false): string;
  262. /**
  263. * Get config value assigned to a config key.
  264. * If config key is not found in database, default value is returned.
  265. * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
  266. *
  267. * @param string $userId id of the user
  268. * @param string $app id of the app
  269. * @param string $key config key
  270. * @param int $default default value
  271. * @param bool $lazy search within lazy loaded config
  272. *
  273. * @return int stored config value or $default if not set in database
  274. * @since 31.0.0
  275. * @see IUserConfig for explanation about lazy loading
  276. * @see getValueString()
  277. * @see getValueFloat()
  278. * @see getValueBool()
  279. * @see getValueArray()
  280. */
  281. public function getValueInt(string $userId, string $app, string $key, int $default = 0, bool $lazy = false): int;
  282. /**
  283. * Get config value assigned to a config key.
  284. * If config key is not found in database, default value is returned.
  285. * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
  286. *
  287. * @param string $userId id of the user
  288. * @param string $app id of the app
  289. * @param string $key config key
  290. * @param float $default default value
  291. * @param bool $lazy search within lazy loaded config
  292. *
  293. * @return float stored config value or $default if not set in database
  294. * @since 31.0.0
  295. * @see IUserConfig for explanation about lazy loading
  296. * @see getValueString()
  297. * @see getValueInt()
  298. * @see getValueBool()
  299. * @see getValueArray()
  300. */
  301. public function getValueFloat(string $userId, string $app, string $key, float $default = 0, bool $lazy = false): float;
  302. /**
  303. * Get config value assigned to a config key.
  304. * If config key is not found in database, default value is returned.
  305. * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
  306. *
  307. * @param string $userId id of the user
  308. * @param string $app id of the app
  309. * @param string $key config key
  310. * @param bool $default default value
  311. * @param bool $lazy search within lazy loaded config
  312. *
  313. * @return bool stored config value or $default if not set in database
  314. * @since 31.0.0
  315. * @see IUserPrefences for explanation about lazy loading
  316. * @see getValueString()
  317. * @see getValueInt()
  318. * @see getValueFloat()
  319. * @see getValueArray()
  320. */
  321. public function getValueBool(string $userId, string $app, string $key, bool $default = false, bool $lazy = false): bool;
  322. /**
  323. * Get config value assigned to a config key.
  324. * If config key is not found in database, default value is returned.
  325. * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
  326. *
  327. * @param string $userId id of the user
  328. * @param string $app id of the app
  329. * @param string $key config key
  330. * @param array $default default value`
  331. * @param bool $lazy search within lazy loaded config
  332. *
  333. * @return array stored config value or $default if not set in database
  334. * @since 31.0.0
  335. * @see IUserConfig for explanation about lazy loading
  336. * @see getValueString()
  337. * @see getValueInt()
  338. * @see getValueFloat()
  339. * @see getValueBool()
  340. */
  341. public function getValueArray(string $userId, string $app, string $key, array $default = [], bool $lazy = false): array;
  342. /**
  343. * returns the type of config value
  344. *
  345. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  346. * unless lazy is set to false
  347. *
  348. * @param string $userId id of the user
  349. * @param string $app id of the app
  350. * @param string $key config key
  351. * @param bool|null $lazy
  352. *
  353. * @return ValueType type of the value
  354. * @throws UnknownKeyException if config key is not known
  355. * @throws IncorrectTypeException if config value type is not known
  356. * @since 31.0.0
  357. */
  358. public function getValueType(string $userId, string $app, string $key, ?bool $lazy = null): ValueType;
  359. /**
  360. * returns a bitflag related to config value
  361. *
  362. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  363. * unless lazy is set to false
  364. *
  365. * @param string $userId id of the user
  366. * @param string $app id of the app
  367. * @param string $key config key
  368. * @param bool $lazy lazy loading
  369. *
  370. * @return int a bitflag in relation to the config value
  371. * @throws UnknownKeyException if config key is not known
  372. * @throws IncorrectTypeException if config value type is not known
  373. * @since 31.0.0
  374. */
  375. public function getValueFlags(string $userId, string $app, string $key, bool $lazy = false): int;
  376. /**
  377. * Store a config key and its value in database
  378. *
  379. * If config key is already known with the exact same config value, the database is not updated.
  380. * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
  381. *
  382. * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
  383. *
  384. * @param string $userId id of the user
  385. * @param string $app id of the app
  386. * @param string $key config key
  387. * @param string $value config value
  388. * @param bool $sensitive if TRUE value will be hidden when listing config values.
  389. * @param bool $lazy set config as lazy loaded
  390. *
  391. * @return bool TRUE if value was different, therefor updated in database
  392. * @since 31.0.0
  393. * @see IUserConfig for explanation about lazy loading
  394. * @see setValueInt()
  395. * @see setValueFloat()
  396. * @see setValueBool()
  397. * @see setValueArray()
  398. */
  399. public function setValueString(string $userId, string $app, string $key, string $value, bool $lazy = false, int $flags = 0): bool;
  400. /**
  401. * Store a config key and its value in database
  402. *
  403. * When handling huge value around and/or above 2,147,483,647, a debug log will be generated
  404. * on 64bits system, as php int type reach its limit (and throw an exception) on 32bits when using huge numbers.
  405. *
  406. * When using huge numbers, it is advised to use {@see \OCP\Util::numericToNumber()} and {@see setValueString()}
  407. *
  408. * If config key is already known with the exact same config value, the database is not updated.
  409. * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
  410. *
  411. * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
  412. *
  413. * @param string $userId id of the user
  414. * @param string $app id of the app
  415. * @param string $key config key
  416. * @param int $value config value
  417. * @param bool $sensitive if TRUE value will be hidden when listing config values.
  418. * @param bool $lazy set config as lazy loaded
  419. *
  420. * @return bool TRUE if value was different, therefor updated in database
  421. * @since 31.0.0
  422. * @see IUserConfig for explanation about lazy loading
  423. * @see setValueString()
  424. * @see setValueFloat()
  425. * @see setValueBool()
  426. * @see setValueArray()
  427. */
  428. public function setValueInt(string $userId, string $app, string $key, int $value, bool $lazy = false, int $flags = 0): bool;
  429. /**
  430. * Store a config key and its value in database.
  431. *
  432. * If config key is already known with the exact same config value, the database is not updated.
  433. * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
  434. *
  435. * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
  436. *
  437. * @param string $userId id of the user
  438. * @param string $app id of the app
  439. * @param string $key config key
  440. * @param float $value config value
  441. * @param bool $sensitive if TRUE value will be hidden when listing config values.
  442. * @param bool $lazy set config as lazy loaded
  443. *
  444. * @return bool TRUE if value was different, therefor updated in database
  445. * @since 31.0.0
  446. * @see IUserConfig for explanation about lazy loading
  447. * @see setValueString()
  448. * @see setValueInt()
  449. * @see setValueBool()
  450. * @see setValueArray()
  451. */
  452. public function setValueFloat(string $userId, string $app, string $key, float $value, bool $lazy = false, int $flags = 0): bool;
  453. /**
  454. * Store a config key and its value in database
  455. *
  456. * If config key is already known with the exact same config value, the database is not updated.
  457. * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
  458. *
  459. * If config value was previously stored as lazy loaded, status cannot be altered without using {@see deleteKey()} first
  460. *
  461. * @param string $userId id of the user
  462. * @param string $app id of the app
  463. * @param string $key config key
  464. * @param bool $value config value
  465. * @param bool $lazy set config as lazy loaded
  466. *
  467. * @return bool TRUE if value was different, therefor updated in database
  468. * @since 31.0.0
  469. * @see IUserConfig for explanation about lazy loading
  470. * @see setValueString()
  471. * @see setValueInt()
  472. * @see setValueFloat()
  473. * @see setValueArray()
  474. */
  475. public function setValueBool(string $userId, string $app, string $key, bool $value, bool $lazy = false): bool;
  476. /**
  477. * Store a config key and its value in database
  478. *
  479. * If config key is already known with the exact same config value, the database is not updated.
  480. * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
  481. *
  482. * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
  483. *
  484. * @param string $userId id of the user
  485. * @param string $app id of the app
  486. * @param string $key config key
  487. * @param array $value config value
  488. * @param bool $sensitive if TRUE value will be hidden when listing config values.
  489. * @param bool $lazy set config as lazy loaded
  490. *
  491. * @return bool TRUE if value was different, therefor updated in database
  492. * @since 31.0.0
  493. * @see IUserConfig for explanation about lazy loading
  494. * @see setValueString()
  495. * @see setValueInt()
  496. * @see setValueFloat()
  497. * @see setValueBool()
  498. */
  499. public function setValueArray(string $userId, string $app, string $key, array $value, bool $lazy = false, int $flags = 0): bool;
  500. /**
  501. * switch sensitive status of a config value
  502. *
  503. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  504. *
  505. * @param string $userId id of the user
  506. * @param string $app id of the app
  507. * @param string $key config key
  508. * @param bool $sensitive TRUE to set as sensitive, FALSE to unset
  509. *
  510. * @return bool TRUE if database update were necessary
  511. * @since 31.0.0
  512. */
  513. public function updateSensitive(string $userId, string $app, string $key, bool $sensitive): bool;
  514. /**
  515. * switch sensitive loading status of a config key for all users
  516. *
  517. * **Warning:** heavy on resources, MUST only be used on occ command or migrations
  518. *
  519. * @param string $app id of the app
  520. * @param string $key config key
  521. * @param bool $sensitive TRUE to set as sensitive, FALSE to unset
  522. *
  523. * @since 31.0.0
  524. */
  525. public function updateGlobalSensitive(string $app, string $key, bool $sensitive): void;
  526. /**
  527. * switch indexed status of a config value
  528. *
  529. * **WARNING:** ignore lazy filtering, all config values are loaded from database
  530. *
  531. * @param string $userId id of the user
  532. * @param string $app id of the app
  533. * @param string $key config key
  534. * @param bool $indexed TRUE to set as indexed, FALSE to unset
  535. *
  536. * @return bool TRUE if database update were necessary
  537. * @since 31.0.0
  538. */
  539. public function updateIndexed(string $userId, string $app, string $key, bool $indexed): bool;
  540. /**
  541. * switch sensitive loading status of a config key for all users
  542. *
  543. * **Warning:** heavy on resources, MUST only be used on occ command or migrations
  544. *
  545. * @param string $app id of the app
  546. * @param string $key config key
  547. * @param bool $indexed TRUE to set as indexed, FALSE to unset
  548. * @since 31.0.0
  549. */
  550. public function updateGlobalIndexed(string $app, string $key, bool $indexed): void;
  551. /**
  552. * switch lazy loading status of a config value
  553. *
  554. * @param string $userId id of the user
  555. * @param string $app id of the app
  556. * @param string $key config key
  557. * @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
  558. *
  559. * @return bool TRUE if database update was necessary
  560. * @since 31.0.0
  561. */
  562. public function updateLazy(string $userId, string $app, string $key, bool $lazy): bool;
  563. /**
  564. * switch lazy loading status of a config key for all users
  565. *
  566. * **Warning:** heavy on resources, MUST only be used on occ command or migrations
  567. *
  568. * @param string $app id of the app
  569. * @param string $key config key
  570. * @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
  571. * @since 31.0.0
  572. */
  573. public function updateGlobalLazy(string $app, string $key, bool $lazy): void;
  574. /**
  575. * returns an array contains details about a config value
  576. *
  577. * ```
  578. * [
  579. * "app" => "myapp",
  580. * "key" => "mykey",
  581. * "value" => "its_value",
  582. * "lazy" => false,
  583. * "type" => 4,
  584. * "typeString" => "string",
  585. * 'sensitive' => true
  586. * ]
  587. * ```
  588. *
  589. * @param string $userId id of the user
  590. * @param string $app id of the app
  591. * @param string $key config key
  592. *
  593. * @return array
  594. * @throws UnknownKeyException if config key is not known in database
  595. * @since 31.0.0
  596. */
  597. public function getDetails(string $userId, string $app, string $key): array;
  598. /**
  599. * Delete single config key from database.
  600. *
  601. * @param string $userId id of the user
  602. * @param string $app id of the app
  603. * @param string $key config key
  604. *
  605. * @since 31.0.0
  606. */
  607. public function deleteUserConfig(string $userId, string $app, string $key): void;
  608. /**
  609. * Delete config values from all users linked to a specific config keys
  610. *
  611. * @param string $app id of the app
  612. * @param string $key config key
  613. *
  614. * @since 31.0.0
  615. */
  616. public function deleteKey(string $app, string $key): void;
  617. /**
  618. * delete all config keys linked to an app
  619. *
  620. * @param string $app id of the app
  621. * @since 31.0.0
  622. */
  623. public function deleteApp(string $app): void;
  624. /**
  625. * delete all config keys linked to a user
  626. *
  627. * @param string $userId id of the user
  628. * @since 31.0.0
  629. */
  630. public function deleteAllUserConfig(string $userId): void;
  631. /**
  632. * Clear the cache for a single user
  633. *
  634. * The cache will be rebuilt only the next time a user config is requested.
  635. *
  636. * @param string $userId id of the user
  637. * @param bool $reload set to TRUE to refill cache instantly after clearing it
  638. *
  639. * @since 31.0.0
  640. */
  641. public function clearCache(string $userId, bool $reload = false): void;
  642. /**
  643. * Clear the cache for all users.
  644. * The cache will be rebuilt only the next time a user config is requested.
  645. *
  646. * @since 31.0.0
  647. */
  648. public function clearCacheAll(): void;
  649. }