| 1 | <?php |
| 2 | /** |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 | * http://www.gnu.org/copyleft/gpl.html |
| 17 | * |
| 18 | * @file |
| 19 | */ |
| 20 | |
| 21 | namespace Wikimedia\LightweightObjectStore; |
| 22 | |
| 23 | /** |
| 24 | * Generic interface providing Time-To-Live constants for expirable object storage |
| 25 | * |
| 26 | * @ingroup Cache |
| 27 | * @since 1.35 |
| 28 | */ |
| 29 | interface ExpirationAwareness { |
| 30 | /** @var int One second, in seconds */ |
| 31 | public const TTL_SECOND = 1; |
| 32 | /** @var int One minute, in seconds */ |
| 33 | public const TTL_MINUTE = 60; |
| 34 | /** @var int One hour, in seconds */ |
| 35 | public const TTL_HOUR = 3_600; |
| 36 | /** @var int One day, in seconds */ |
| 37 | public const TTL_DAY = 86_400; |
| 38 | /** @var int One week, in seconds */ |
| 39 | public const TTL_WEEK = 604_800; |
| 40 | /** @var int One month, in seconds */ |
| 41 | public const TTL_MONTH = 2_592_000; |
| 42 | /** @var int One year, in seconds */ |
| 43 | public const TTL_YEAR = 31_536_000; |
| 44 | |
| 45 | /** @var int Reasonably strict cache time that last the life of quick requests */ |
| 46 | public const TTL_PROC_SHORT = 3; |
| 47 | /** @var int Loose cache time that can survive slow web requests */ |
| 48 | public const TTL_PROC_LONG = 30; |
| 49 | |
| 50 | /** @var int Idiom for "store indefinitely" */ |
| 51 | public const TTL_INDEFINITE = 0; |
| 52 | /** @var int Idiom for "do not store the newly generated result" */ |
| 53 | public const TTL_UNCACHEABLE = -1; |
| 54 | } |