Closed paceband closed 5 years ago
Go to .env and write CACHE_DRIVER=array
Is it possible to do this without changing the cache driver to array? In the previous version this worked fine with the file driver, is there a way we can still do this with the file driver? I am a bit concerned about how it might effect the rest of the system.
@omer414 You can set the cache_tags to null or remove it completely from the config file. This will prevent using cache tags, but still cache. By doing this you lose the ability to clear the geoip only cache via the artisan command.
'cache_tags' => null,
@SandeeshS Is it ok to lose the ability to clear the geoip? ..and. I'm using laravel 5.1, how can I remove it?
Here's my cache.php:
<?php
return [
'default' => env('CACHE_DRIVER', 'file'),
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
'prefix' => 'laravel',
];
@jonjie0317 The caching mentioned here is about caching the geo ip info only. Caching is always recommended to speed up and avoid looking up the same ip info over and over again. The package provides an artisan command to clear only the geo ip related cache. But this feature does not work with file or database cache. This also means that the package used to break on using these types of cache. A work over around was to lose the ability to clear geo ip only cache and yet have the package working and cache normally. You need to edit the geoip.php config file to get it working.
@SandeeshS So how can I remove cache tags? Thank you for your answer
To remove the cache tags you can set the option to null in the config file.
'cache_tags' => null,
@SandeeshS is it the config
file? hm, by the way, Im using Laravel5.1
It's the geoip.php file inside your config folder. If you don't have it already, run the following command to publish the package config file.
php artisan vendor:publish --provider="Torann\GeoIP\GeoIPServiceProvider" --tag=config
It returns Nothing to publish for tag [config].
Please check the latest documentation and make sure your installation is correct. http://lyften.com/projects/laravel-geoip/doc/
You should ultimately have the 'config/geoip.php' config file.
Ow, thanks a lot 👍 I'll try
@SandeeshS It still not working huhu
Are you using the latest version of the package? You must be doing something wrong. Why don't you try removing and adding the package again via composer. If all fails, you can manually copy paste the geoip,php to your config folder from the source.
Yes, and it returns This cache store does not support tagging.
I just installed a copy of laravel and this package and tested it with the default file caching and it works. Please check if you're doing everything right on your end.
https://github.com/Torann/laravel-geoip/issues/64#issuecomment-296977258
@jonjie0317 Are you editing the geoip.php in the vendor directory or in the config folder of the project root? Be sure the path is 'config/geoip.php' not 'vendor/torann/geoip/config/geoip.php'.
Solved with this
'cache_tags' => env('CACHE_DRIVER', 'array') === "file" ? null : ['torann-geoip-location'],
Error:
` In CacheManager.php line 96:
Cache store [] is not defined.`
Fix:
\config\cache.php
`<?php
return [ /* | -------------------------------------------------------------------------- | Cache Stores |
---|---|---|
Here you may define all of the cache "stores" for your application as | ||
well as their drivers. You may even define multiple stores for the | ||
same cache driver to group types of items stored in your caches. | ||
*/
'default' => env('CACHE_DRIVER', 'file'),
'stores' => [
'apc' => [
'driver' => 'apc',
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
]; `
this is working for me
Composer:
"require": { "php": ">=7.1.3", "illuminate/redis": "5.7", "laravel-doctrine/extensions": "^1.0", "laravel-doctrine/orm": "^1.4", "laravel/lumen-framework": "5.7.*", "vlucas/phpdotenv": "~2.2" },
Hi,
When "CACHE_DRIVER=file" is receive this error:
BadMethodCallException in Repository.php line 391: This cache store does not support tagging. in Repository.php line 391 at Repository->tags(array('torann-geoip-location')) in CacheManager.php line 301 at CacheManager->__call('tags', array(array('torann-geoip-location'))) in Cache.php line 32 at Cache->__construct(object(CacheManager), array('torann-geoip-location'), '30') in GeoIP.php line 91
Unfortunatly, I must configure my cache this way to make it work: CACHE_DRIVER=array
FYI, I'm upgrading from 0.2 to 1.0. Was working with "CACHE_DRIVER=file"
Any ideas?