Skip to content

Trigger notice on memcached set failure #71

Description

@KminekMatej
  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions