Implemented caching of our base_dn

This commit is contained in:
Deon George
2023-01-28 23:07:39 +11:00
parent 210793e814
commit 413f1ec065
6 changed files with 97 additions and 10 deletions

View File

@@ -2,10 +2,11 @@
namespace App\Classes\LDAP;
use Carbon\Carbon;
use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use LdapRecord\Models\Model;
use LdapRecord\Query\Collection;
use LdapRecord\Query\Model\Builder;
@@ -24,6 +25,7 @@ class Server
{
return ($x=(new Entry)
->query()
->cache(Carbon::now()->addSeconds(Config::get('ldap.cache.time')))
->select(['*','hassubordinates'])
->setDn($dn)
->listing()
@@ -41,6 +43,7 @@ class Server
{
return ($x=(new Entry)
->query()
->cache(Carbon::now()->addSeconds(Config::get('ldap.cache.time')))
->select($attrs)
->find($dn)) ? $x : NULL;
}