2017 © Pedro Peláez
 

library cacheable-auth-user

Cache Auth::user() for Laravel 5 This package add new driver to laravel.

image

itime/cacheable-auth-user

Cache Auth::user() for Laravel 5 This package add new driver to laravel.

  • Sunday, November 19, 2017
  • by itime
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 6 Versions
  • 17 % Grown

The README.md

cacheable-auth-user

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Cacheable Auth::user() for Laravel 5.3 or 5.4., (*2)

Installation

Composer, (*3)

composer require hobbiot/cacheable-auth-user

Laravel

app.php

In your config/app.php add HobbIoT\Auth\CacheableAuthUserServiceProvider::class to the end of the providers array:, (*4)

'providers' => [
    ...
        HobbIoT\Auth\CacheableAuthUserServiceProvider::class,
    ...
],

auth.php

In your config/auth.php change User Providers' driver. You can now use "cacheableEloquent"., (*5)

...
    'providers' => [
        'users' => [
            'driver' => 'cacheableEloquent',
            'model' => App\User::class,
        ],
        // e.g.
        'admin' => [
            'driver' => 'cacheableEloquent',
            'model' => App\Administrator::class,
        ],
    ],
...
],

Administrator::class needs to extend Authenticatable (Illuminate\Foundation\Auth\User) and use trait Notifiable (Illuminate\Notifications\Notifiable), just like App\User::class., (*6)

Supplementary Explanation

  • The cache is valid for 60 minutes.
  • The cache Key is ModelClassName__By_Id__id and ModelClassName__By_Id_Token__id.
  • Using Eloquent updated event listener to clear cache, need to use model->save(). When user update his name in profile page, fire updated event automatically, (listen event and) clear cache. After that reload from resources (database)., (*7)

    Laravel Official Documentation said,, (*8)

    Note: When issuing a mass update via Eloquent, the saved and updated model events will not be fired for the updated models. This is because the models are never actually retrieved when issuing a mass update., (*9)

The Versions

19/11 2017

dev-master

9999999-dev

Cache Auth::user() for Laravel 5 This package add new driver to laravel.

  Sources   Download

MIT

The Requires

 

laravel cache auth

19/11 2017

1.0.2

1.0.2.0

Cache Auth::user() for Laravel 5 This package add new driver to laravel.

  Sources   Download

MIT

The Requires

 

laravel cache auth

04/06 2017

1.0.1

1.0.1.0

Cache Auth::user() for Laravel 5.3. This package add new driver to laravel.

  Sources   Download

MIT

The Requires

 

laravel cache auth

06/11 2016

1.0.0

1.0.0.0

cacheable Auth::user() for Laravel 5.3

  Sources   Download

MIT

The Requires

 

laravel cache auth

06/11 2016

0.9.1

0.9.1.0

cacheable Auth::user() for Laravel 5.3

  Sources   Download

No License

The Requires

 

laravel cache auth

06/11 2016

0.9.0

0.9.0.0

cacheable Auth::user() for Laravel 5.3

  Sources   Download

No License

The Requires

 

laravel cache auth