uwsgi.cache_set() not working in separate thread inside a mule process The Next CEO of Stack OverflowWhat is the difference between a process and a thread?Is there any way to kill a Thread?“implements Runnable” vs “extends Thread” in JavaHow do I update the GUI from another thread?What is thread safe or non-thread safe in PHP?What is a daemon thread in Java?How to use threading in Python?Multiprocessing vs Threading PythonHow do servlets work? Instantiation, sessions, shared variables and multithreadinguWSGI restarts attached processes without stopping old ones
Math-accent symbol over parentheses enclosing accented symbol (amsmath)
How did people program for Consoles with multiple CPUs?
Proper way to express "He disappeared them"
What does "Its cash flow is deeply negative" mean?
Make solar eclipses exceedingly rare, but still have new moons
The exact meaning of 'Mom made me a sandwich'
INSERT to a table from a database to other (same SQL Server) using Dynamic SQL
Is it ever safe to open a suspicious HTML file (e.g. email attachment)?
0 rank tensor vs 1D vector
How to install OpenCV on Raspbian Stretch?
What was the first Unix version to run on a microcomputer?
Is there always a complete, orthogonal set of unitary matrices?
Chain wire methods together in Lightning Web Components
Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?
Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?
Does Germany produce more waste than the US?
Is it my responsibility to learn a new technology in my own time my employer wants to implement?
How many extra stops do monopods offer for tele photographs?
How to avoid supervisors with prejudiced views?
Is it okay to majorly distort historical facts while writing a fiction story?
Why this way of making earth uninhabitable in Interstellar?
How do I align (1) and (2)?
Why do remote US companies require working in the US?
Running a General Election and the European Elections together
uwsgi.cache_set() not working in separate thread inside a mule process
The Next CEO of Stack OverflowWhat is the difference between a process and a thread?Is there any way to kill a Thread?“implements Runnable” vs “extends Thread” in JavaHow do I update the GUI from another thread?What is thread safe or non-thread safe in PHP?What is a daemon thread in Java?How to use threading in Python?Multiprocessing vs Threading PythonHow do servlets work? Instantiation, sessions, shared variables and multithreadinguWSGI restarts attached processes without stopping old ones
For experiment, I set up a cache uwsgi.cache_set('test', data) inside a mule process. The cache is set as expected.
Now I spawn a thread from which I can access that cache
Threading is enabled in uwsgi.ini:
[uwsgi]
threads = 4
in mule.py:
#Threaded function
def a_function():
uwsgi.cache_set('test', b'NOT OK') <- Nothing happens here
cache_return = uwsgi.cache_get('test') <- Returns b'OK' which means the cache did not overwrite the previous value.
if __name__ == '__main__':
cache = uwsgi.cache_set('test', b'OK') <- Works here
cache_return = uwsgi.cache_get('test') <- Return b'OK', as expected
t = Thread(target=a_function)
t.start()
The question is why does this happen and how do I set caches from inside a thread.
python-3.x multithreading caching uwsgi
add a comment |
For experiment, I set up a cache uwsgi.cache_set('test', data) inside a mule process. The cache is set as expected.
Now I spawn a thread from which I can access that cache
Threading is enabled in uwsgi.ini:
[uwsgi]
threads = 4
in mule.py:
#Threaded function
def a_function():
uwsgi.cache_set('test', b'NOT OK') <- Nothing happens here
cache_return = uwsgi.cache_get('test') <- Returns b'OK' which means the cache did not overwrite the previous value.
if __name__ == '__main__':
cache = uwsgi.cache_set('test', b'OK') <- Works here
cache_return = uwsgi.cache_get('test') <- Return b'OK', as expected
t = Thread(target=a_function)
t.start()
The question is why does this happen and how do I set caches from inside a thread.
python-3.x multithreading caching uwsgi
add a comment |
For experiment, I set up a cache uwsgi.cache_set('test', data) inside a mule process. The cache is set as expected.
Now I spawn a thread from which I can access that cache
Threading is enabled in uwsgi.ini:
[uwsgi]
threads = 4
in mule.py:
#Threaded function
def a_function():
uwsgi.cache_set('test', b'NOT OK') <- Nothing happens here
cache_return = uwsgi.cache_get('test') <- Returns b'OK' which means the cache did not overwrite the previous value.
if __name__ == '__main__':
cache = uwsgi.cache_set('test', b'OK') <- Works here
cache_return = uwsgi.cache_get('test') <- Return b'OK', as expected
t = Thread(target=a_function)
t.start()
The question is why does this happen and how do I set caches from inside a thread.
python-3.x multithreading caching uwsgi
For experiment, I set up a cache uwsgi.cache_set('test', data) inside a mule process. The cache is set as expected.
Now I spawn a thread from which I can access that cache
Threading is enabled in uwsgi.ini:
[uwsgi]
threads = 4
in mule.py:
#Threaded function
def a_function():
uwsgi.cache_set('test', b'NOT OK') <- Nothing happens here
cache_return = uwsgi.cache_get('test') <- Returns b'OK' which means the cache did not overwrite the previous value.
if __name__ == '__main__':
cache = uwsgi.cache_set('test', b'OK') <- Works here
cache_return = uwsgi.cache_get('test') <- Return b'OK', as expected
t = Thread(target=a_function)
t.start()
The question is why does this happen and how do I set caches from inside a thread.
python-3.x multithreading caching uwsgi
python-3.x multithreading caching uwsgi
edited Mar 7 at 16:42
Temperosa
asked Mar 7 at 16:37
TemperosaTemperosa
4215
4215
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
OK it seems like I used the wrong function (cache_set) instead of cache_update.
uwsgi.cache_set(key, value[, expire, cache_name])
Set a value in the cache. If the key is already set but not expired,
it doesn’t set anything.
uwsgi.cache_update(key, value[, expire, cache_name])
Update a value in the cache. This always sets the key, whether it was
already set before or not and whether it has expired or not.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55048752%2fuwsgi-cache-set-not-working-in-separate-thread-inside-a-mule-process%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
OK it seems like I used the wrong function (cache_set) instead of cache_update.
uwsgi.cache_set(key, value[, expire, cache_name])
Set a value in the cache. If the key is already set but not expired,
it doesn’t set anything.
uwsgi.cache_update(key, value[, expire, cache_name])
Update a value in the cache. This always sets the key, whether it was
already set before or not and whether it has expired or not.
add a comment |
OK it seems like I used the wrong function (cache_set) instead of cache_update.
uwsgi.cache_set(key, value[, expire, cache_name])
Set a value in the cache. If the key is already set but not expired,
it doesn’t set anything.
uwsgi.cache_update(key, value[, expire, cache_name])
Update a value in the cache. This always sets the key, whether it was
already set before or not and whether it has expired or not.
add a comment |
OK it seems like I used the wrong function (cache_set) instead of cache_update.
uwsgi.cache_set(key, value[, expire, cache_name])
Set a value in the cache. If the key is already set but not expired,
it doesn’t set anything.
uwsgi.cache_update(key, value[, expire, cache_name])
Update a value in the cache. This always sets the key, whether it was
already set before or not and whether it has expired or not.
OK it seems like I used the wrong function (cache_set) instead of cache_update.
uwsgi.cache_set(key, value[, expire, cache_name])
Set a value in the cache. If the key is already set but not expired,
it doesn’t set anything.
uwsgi.cache_update(key, value[, expire, cache_name])
Update a value in the cache. This always sets the key, whether it was
already set before or not and whether it has expired or not.
answered Mar 7 at 18:03
TemperosaTemperosa
4215
4215
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55048752%2fuwsgi-cache-set-not-working-in-separate-thread-inside-a-mule-process%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown