ArrayableTrait.php
2 years ago
BenchmarkTrait.php
2 years ago
BooleanTransientTrait.php
5 years ago
DatabaseSearchReplaceTrait.php
2 years ago
DbRowsGeneratorTrait.php
3 years ago
DeveloperTimerTrait.php
4 years ago
EndOfLinePlaceholderTrait.php
2 years ago
EventLoggerTrait.php
1 year ago
FileScanToCacheTrait.php
2 years ago
HydrateTrait.php
2 years ago
MaintenanceTrait.php
5 years ago
MemoryExhaustTrait.php
2 years ago
MySQLRowsGeneratorTrait.php
2 years ago
NoticesTrait.php
2 years ago
PropertyConstructor.php
5 years ago
ResourceTrait.php
2 years ago
ValueGetterTrait.php
1 year ago
BooleanTransientTrait.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Framework\Traits; |
| 4 | |
| 5 | trait BooleanTransientTrait |
| 6 | { |
| 7 | abstract function getTransientName(); |
| 8 | |
| 9 | abstract function getExpiryTime(); |
| 10 | |
| 11 | /** |
| 12 | * Set the initial transient to value to true |
| 13 | */ |
| 14 | public function setTransient() |
| 15 | { |
| 16 | set_transient($this->getTransientName(), true, $this->getExpiryTime()); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @return bool |
| 21 | */ |
| 22 | public function getTransient() |
| 23 | { |
| 24 | return get_transient($this->getTransientName()); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Delete the transient |
| 29 | */ |
| 30 | public function deleteTransient() |
| 31 | { |
| 32 | delete_transient($this->getTransientName()); |
| 33 | } |
| 34 | } |
| 35 |