Closed SimonSimCity closed 11 years ago
Just one question left ...
The interface defines the methods "insert" and "update". In Couchbase you have "add" which will return an error if the data-set exists, "replace" which will only save the data if the data-set exists and "set" which will save the data whether the key already exists or not.
I used "add" for "insert". Please write it down if that's wrong implemented.
The DBALStorage uses a SQL Insert so it will also fail on existing keys: https://github.com/doctrine/KeyValueStore/blob/master/lib/Doctrine/KeyValueStore/Storage/DBALStorage.php#L78 However, you should catch the exception to be consistent, and either discard it (behavior of the DBALStorage but probably bad for debugging) or wrap it in a StorageException (behavior of the WindowsAzureTableStorage). @beberlei what should be the storage behavior ?
and you should add a suggestion for ext-couchbase
in the composer.json
The current implementation will just do nothing as you don't get a return-value ... The php-extension returns FALSE if insert or update fails - but I don't know how to handle it ..
The current implementation for DBAL f.e. is quite loosy as well .. they all don't care if the functions fail. Like it looks for me, this KeyValueStore's are just thought for caching ... It's not sure if your data really got saved.
@SimonSimCity they are the storage, not a cache (except if you use the whole KeyValueStore as a cache)
@stof: I know that ... but every implementation in here is build this way, that if an error occurs, f.e. during adding (key already exists ..), it's just ignored. But that's another discussion ;)
@SimonSimCity thank you for the pull request, very much appreciated!
Added a storage implementation for couchbase.
Or do you think that memcache would be enough, as it's a drop-in replacement? http://www.couchbase.com/memcached