I would love to know for sure, but I would guess that, since tags are added to the keys, and not the other way around, they would get overriden.
Wouldn't an easier way be just to use:
Cache::forever('key'.$uniq, $var1);
This must be extremely easy to just try out? (I'm on iPhone)
christoffertyrefors said:
This must be extremely easy to just try out? (I'm on iPhone)
You would think.
I tried it but when it tossed and error I consulted the docs, http://laravel.com/docs/4.2/cache#cache-tags
Note: Cache tags are not supported when using the file or database cache drivers. Furthermore, when using multiple tags with caches that are stored "forever", performance will be best with a driver such as memcached, which automatically purges stale records.
But from the examples it appears it would work.
This is indeed easy to test. This is allowed and here are the results:
Cache::tags('a')->forever('key','test1');
Cache::tags('b')->forever('key','test2');
echo Cache::get('key');
// prints nothing
echo Cache::tags('a')->get('key');
// prints "test1"
echo Cache::tags('b')->get('key');
// prints "test2"
Wait, so I was wrong? Is it really that easy to uniquely cache things? This changes at least a few things then.
DaveMC08 said:
Wait, so I was wrong? Is it really that easy to uniquely cache things? This changes at least a few things then.
This appears to be how it functions. Nothing is overwritten which makes my life a lot easier.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community