Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Phpfastcache class extending #830

thomich started this conversation in General
Discussion options

Hello

With the Class example: https://github.com/PHPSocialNetwork/phpfastcache/blob/master/docs/examples/extendedPhpFastCache.php i implemented my own cache class which extends PhpfastcacheAbstractProxy.

Alls fine so far, expect the all know PHP notice: Calling many times CacheManager::getInstance() for already instanced...
My own cache class and the constructor:
Selection_002

Then i have a own method to get a cached item:
Selection_003

Now in my other classes where i need to work with the cache i use the own cache class:

use app\cache;

And then i load it in the construct of that other class to use it:
$this->cache = new cache();

I know, thats exact the thing that will give above PHP notice warning.. i know...
If i read trough the extendedPhpFastCache example.. i only see the own cache class.. but how to call/load it in other files to re-use it without PHP notice warning?

Hints are very welcome ;)

Thanks a lot
thomi

You must be logged in to vote

Replies: 2 comments

Comment options

Hello,

You need to store (statically or in an other way) your cache instance along your script.

Because actually something is calling the CacheManager multiple times with the same settings.

You must be logged in to vote
0 replies
Comment options

hey @Geolim4

many thanks.. smart hint and solved ;)

regards
thomi

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /