I am using Suffix Tree wrapper for python Programmer. https://hkn.eecs.berkeley.edu/~dyoo/python/suffix_trees/
I need the same instance of Suffix tree every time, a views is called in Django. So, I store the Suffix tree instance in django-cache and retrieve it every time when I requires that instance.
Problem 1: When I retrieve it from cache, it always changes memory location. Even when python store data using references.
Problem 2: After 2 retrievals, the python floats a "Segmentation fault (core dumped)"
Ques 1: Why instance of Suffix Tree changes its memory location from cache?
Ques 2: Why it is showing segmentation fault?
Ques 3: Is their any other way to store the persistent instance of Suffix Tree somewhere in django, with same instance?
$ python manage.py shell
Python 2.7.5 (default, Mar 22 2016, 00:57:36)
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import SuffixTree
>>> d=SuffixTree.SubstringDict()
>>> d["3132"]=1
>>> d["3"]
[1]
>>> d["4343"]=2
>>> d["3"]
[1, 2]
>>> from django.core.cache import cache
>>> cache.set("c",d,1000)
>>> d
<SuffixTree.SubstringDict.SubstringDict instance at 0x27bd830>
>>> cache.get("c")
<SuffixTree.SubstringDict.SubstringDict instance at 0x27ca908>
>>> cache.get("c")
<SuffixTree.SubstringDict.SubstringDict instance at 0x27ca9e0>
>>> cache.get("c")
Segmentation fault (core dumped)