completed cache magic update

This commit is contained in:
Unbit
2013-03-08 16:26:16 +01:00
parent 61722a7876
commit f3b1acc55e
3 changed files with 16 additions and 24 deletions
+7 -21
View File
@@ -2604,7 +2604,7 @@ PyObject *py_uwsgi_cache_set(PyObject * self, PyObject * args) {
PyObject *py_uwsgi_cache_update(PyObject * self, PyObject * args) {
char *key;
char *key;
char *value;
Py_ssize_t vallen = 0;
Py_ssize_t keylen = 0;
@@ -2616,27 +2616,13 @@ PyObject *py_uwsgi_cache_update(PyObject * self, PyObject * args) {
return NULL;
}
if ((uint64_t)vallen > uwsgi.caches->blocksize) {
return PyErr_Format(PyExc_ValueError, "uWSGI cache items size must be < %llu, requested %llu bytes", (unsigned long long)uwsgi.caches->blocksize, (unsigned long long) vallen);
}
if (remote && strlen(remote) > 0) {
UWSGI_RELEASE_GIL
//uwsgi_simple_send_string2(remote, 111, 1, key, keylen, value, vallen, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
UWSGI_GET_GIL
}
else if (uwsgi.caches) {
UWSGI_RELEASE_GIL
uwsgi_wlock(uwsgi.caches->lock);
if (uwsgi_cache_set(key, keylen, value, vallen, expires, UWSGI_CACHE_FLAG_UPDATE)) {
uwsgi_rwunlock(uwsgi.caches->lock);
UWSGI_GET_GIL
Py_INCREF(Py_None);
return Py_None;
}
uwsgi_rwunlock(uwsgi.caches->lock);
UWSGI_GET_GIL
UWSGI_RELEASE_GIL
if (uwsgi_cache_magic_set(key, keylen, value, vallen, expires, UWSGI_CACHE_FLAG_UPDATE, remote)) {
UWSGI_GET_GIL
Py_INCREF(Py_None);
return Py_None;
}
UWSGI_GET_GIL
Py_INCREF(Py_True);
return Py_True;