mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.26k stars 217 forks source link

Multiple Connection Database (Sub Connection) Cache No Function #191

Closed bluevyjohn closed 5 years ago

bluevyjohn commented 5 years ago

@mikebronner Multiple Connection Database (Sub Connection) Cache No Function

I have follow your instruction, but for model those connect sub connection , create, update,delete the cache still is no updated, it keep maintain old 1...

for example:

use GeneaLabs\LaravelModelCaching\Traits\Cachable;
class Companies extends Model
{
    use Cachable;
    public function __construct($attributes = [])
    {
        config(['laravel-model-caching.cache-prefix' => 'seconddb']);

        parent::__construct($attributes);
    }
    //use global connection database
    protected $connection= 'seconddb';

    protected $dates = ['deleted_at'];

    protected $table = 'companies';

    protected $guarded  = ['id'];
}

Environment

Additional context Add any other context about the problem here.

mikebronner commented 5 years ago

@bluevyjohn have you added the cache prefix to all the other models on firstdb? I think that might solve the issue.

mikebronner commented 5 years ago

Closing this for now. Please re-open if this issue persists.