Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger notice on memcached set failure #71

Open
KminekMatej opened this issue Feb 16, 2023 · 0 comments
Open

Trigger notice on memcached set failure #71

KminekMatej opened this issue Feb 16, 2023 · 0 comments

Comments

@KminekMatej
Copy link
Contributor

  • I found out Memcached is not storing some structure I wanted. I discovered that set() function fails, responding with false. Later I discovered reason using Memcached::getResultCode() which I found in phpDoc.

  • This response, however is not handled in Nette. I suggest failure on write to cache should at least trigger notice for user.

I will gladly make a PR, but before I would like to know author's opinion.

Instead of

$this->memcached->set($key, $meta, $expire);

I would suggest something like:

		$stored = $this->memcached->set($key, $meta, $expire);
                
                if(!$stored){
                    trigger_error("Storing to memcached failed with error ".$this->memcached->getResultCode().": " . $this->memcached->getResultMessage(), E_USER_NOTICE);
                }

⚠️ Adding new Notice might consider that as a Breaking Change - Im not completely familiar with these internal rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant