Page MenuHomePhorge

Cache.php
No OneTemporary

Authored By
Unknown
Size
942 B
Referenced Files
None
Subscribers
None

Cache.php

<?php
namespace App\Policy\SPF;
use Illuminate\Support\Facades\Cache as LaravelCache;
/**
* A caching layer for SPF check results, as sometimes the chasing of DNS entries can take a while but submissions
* inbound are virtually not rate-limited.
*
* A cache key should have the format of ip(4|6)_id_domain and last for 12 hours.
*
* A cache value should have a serialized version of the \SPFLib\Checker.
*/
class Cache
{
public static function get($key)
{
if (LaravelCache::has($key)) {
return LaravelCache::get($key);
}
return null;
}
public static function has($key)
{
return LaravelCache::has($key);
}
public static function set($key, $value)
{
if (LaravelCache::has($key)) {
LaravelCache::forget($key);
}
// cache the DNS record result for 12 hours
LaravelCache::put($key, $value, 60 * 60 * 12);
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Apr 24, 1:17 PM (4 d, 44 s ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18747696
Default Alt Text
Cache.php (942 B)

Event Timeline