[Flask] Storage Context

Ben Duncan linux4ms at gmail.com
Fri Jul 26 11:46:24 EDT 2019


Thanks, I will!
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Jul 26, 2019 at 10:35 AM Gergely Polonkai <gergely at polonkai.eu>
wrote:

> Should be, yes. Have fun using it 😉
>
> On Fri, 26 Jul 2019, 17:34 Ben Duncan, <linux4ms at gmail.com> wrote:
>
>> Thansk for the info - I used :
>> pip install flask-caching , is that the right one?
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Fri, Jul 26, 2019 at 10:11 AM Gergely Polonkai <gergely at polonkai.eu>
>> wrote:
>>
>>> If you are talking about https://github.com/thadeusb/Flask-cache,
>>> please be aware that that module is unmaintained for 5 years now.
>>> Flask-Caching (https://flask-caching.readthedocs.io/en/latest/) is a
>>> maintained fork of that project.
>>>
>>> On Fri, 26 Jul 2019, 17:07 Ben Duncan, <linux4ms at gmail.com> wrote:
>>>
>>>> Ok, looks like Flask-Cache maybe what I am looking for.
>>>> I will RTFM some more ...
>>>>
>>>> Thanks ..
>>>>
>>>> *Ben Duncan*
>>>> DBA / Chief Software Architect
>>>> Mississippi State Supreme Court
>>>> Electronic Filing Division
>>>>
>>>>
>>>> On Fri, Jul 26, 2019 at 9:49 AM Gergely Polonkai <gergely at polonkai.eu>
>>>> wrote:
>>>>
>>>>> Thatʼs exactly what i found. That callable list thing is nothing i
>>>>> have heard before and canʼt really see a use case.
>>>>>
>>>>> The persistent dict thing is what Iʼd use a cache for, Flask-Caching
>>>>> or not.
>>>>>
>>>>> Best,
>>>>> Gergely
>>>>>
>>>>> On Fri, 26 Jul 2019, 16:45 Ben Duncan, <linux4ms at gmail.com> wrote:
>>>>>
>>>>>> Kinda sorta, more like a persistence dict / list
>>>>>>
>>>>>> Best documentation I could find describing it:
>>>>>>
>>>>>> Module storagesource code
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage-pysrc.html>
>>>>>>
>>>>>> This file is part of the web2py Web Framework
>>>>>> Copyrighted by Massimo Di Pierro <mdipierro at cs.depaul.edu>
>>>>>> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
>>>>>>
>>>>>> Provides:
>>>>>>
>>>>>> - List; like list but returns None instead of IndexOutOfBounds
>>>>>> - Storage; like dictionary allowing also for `obj.foo` for `obj['foo']`
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Classes [hide private
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage-module.html#section-Classes>
>>>>>> ]
>>>>>>   List
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage.List-class.html>
>>>>>> Like a regular python list but a[i] if i is out of bounds return None
>>>>>> instead of IndexOutOfBounds
>>>>>>   Storage
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage.Storage-class.html>
>>>>>> A Storage object is like a dictionary except `obj.foo` can be used in
>>>>>> addition to `obj['foo']`.
>>>>>>   StorageList
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage.StorageList-class.html>
>>>>>> like Storage but missing elements default to [] instead of None
>>>>>>   Settings
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage.Settings-class.html>
>>>>>>   Messages
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage.Messages-class.html>
>>>>>> Functions [hide private
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage-module.html#section-Functions>
>>>>>> ]
>>>>>>
>>>>>> load_storage(filename) source code
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage-pysrc.html#load_storage>
>>>>>>
>>>>>> save_storage(storage, filename) source code
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon.storage-pysrc.html#save_storage>
>>>>>>    Home
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/web2py.gluon-module.html>
>>>>>>        Trees
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/module-tree.html>
>>>>>>        Indices
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/identifier-index.html>
>>>>>>        Help
>>>>>> <http://gelfand.crbs.ucsd.edu/examples/static/epydoc/help.html>
>>>>>>
>>>>>>
>>>>>> *Ben Duncan*
>>>>>> DBA / Chief Software Architect
>>>>>> Mississippi State Supreme Court
>>>>>> Electronic Filing Division
>>>>>>
>>>>>>
>>>>>> On Fri, Jul 26, 2019 at 8:26 AM Gergely Polonkai <gergely at polonkai.eu>
>>>>>> wrote:
>>>>>>
>>>>>>> I never used web2py, but from the documentation it looks like some
>>>>>>> basic caching functionality. If this is the case, you should check
>>>>>>> Flask-Caching (a fork of the unmaintained Flask-Cache). It can store the
>>>>>>> cache in memory or in a file, or connect to memcached, Redis, and a bunch
>>>>>>> of other storage backends.
>>>>>>>
>>>>>>> (Disclaimer: i’m one of the maintainers of that package).
>>>>>>>
>>>>>>> If, however, you don’t need a persistent(ish) cache, the simplest
>>>>>>> solution is probably to set g.my_storage to a dictionary and use the
>>>>>>> dictionary methods to access it.
>>>>>>>
>>>>>>> Best,
>>>>>>> Gergely
>>>>>>>
>>>>>>>
>>>>>>> Gergely Polonkai
>>>>>>> [image: https://]about.me/gergely.polonkai
>>>>>>>
>>>>>>> <https://about.me/gergely.polonkai?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links>
>>>>>>>
>>>>>>>
>>>>>>> fös., 26. júl. 2019 kl. 13:16 skrifaði Ben Duncan <
>>>>>>> linux4ms at gmail.com>:
>>>>>>>
>>>>>>>> Ok, I'm coming form web2py and adopting Flask
>>>>>>>> However, one of the things I had under web2py is a module called
>>>>>>>> Storage.
>>>>>>>> It worked much like a memcach database.
>>>>>>>>
>>>>>>>> See: https://web2py.readthedocs.io/en/latest/storage.html
>>>>>>>>
>>>>>>>> Is there anything like that in Flask?
>>>>>>>> I've adapted the storage module for my use in Flask, but I'd rather
>>>>>>>> use anything native
>>>>>>>> to Flask.
>>>>>>>>
>>>>>>>> Thanks ..
>>>>>>>>
>>>>>>>> *Ben Duncan*
>>>>>>>> DBA / Chief Software Architect
>>>>>>>> Mississippi State Supreme Court
>>>>>>>> Electronic Filing Division
>>>>>>>> _______________________________________________
>>>>>>>> Flask mailing list
>>>>>>>> Flask at python.org
>>>>>>>> https://mail.python.org/mailman/listinfo/flask
>>>>>>>>
>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20190726/c053da21/attachment-0001.html>


More information about the Flask mailing list