Skip to content

A simple model to realize stack proxy like what Flask context management does. 一个实现类似Flask栈数据代理的基本模型。

Notifications You must be signed in to change notification settings

mikellxy/stack_proxy_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stack_proxy_model

A simple model to realize stack proxy like what Flask context management does. 一个实现类似Flask栈数据代理的基本模型。


In practice, we sometimes need to put different kind of data in a dict on the top of a stack, for example, the threading/coroutine specific data or whatever. Then we have to provide key when we need to read the right thing from the stack top. One way to prove this is to define a proxy object to handle the stack. The proxy can tell which is the right thing need to be got, as it can handle which threading the code is running on and get the threading specific data. In this way, we can use the proxy as a global var which can always get the right thing from the stack.

Structure of this project:
"_local" package: processing of the stack
"_global" package: where the proxy is defined
"manage.py": run from here

About

A simple model to realize stack proxy like what Flask context management does. 一个实现类似Flask栈数据代理的基本模型。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages