Skip to content

Trigger notice on memcached set failure #71

@KminekMatej

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions