1

Laravel:5.6 Php:7.1

I am having multiple tenants(platforms) application with the single codebase and using the file cache. I need to handle the cache removal for specific platform.

I tried to set the cache config storage path on runtime to set the different cache paths with respect to the platforms. But it got the default settings from config/cache.php once I try to put the cache using the following method

Cache::store('file')->put($key, $data, CACHE_MINUTES);
Abdul Samad
  • 81
  • 1
  • 8
  • I'd change the keys to be something tenant specific. So for example add a prefix to the cache keys which is unique per tennant. – Tuim Jun 27 '18 at 07:06
  • @Tuim thanks for your response, but I think so the prefix only works using APC or Memcached. However, I am using the file based cache. – Abdul Samad Jun 27 '18 at 07:10
  • `$key = $tennant->id.'-'.$key` Something like this would work I suppose. – Tuim Jun 27 '18 at 09:16

1 Answers1

0

How do you set cache config? Is it like

config(['cache.stores.file.path'=>$tenantPath]);
Cache::store('file')->put($key, $data, CACHE_MINUTES);
kingshark
  • 315
  • 1
  • 2
  • 11