Hi Dwayne, I would suggest just use the django cache api:
https://docs.djangoproject.com/en/dev/topics/cache/#the-low-level-cache-api Memcache is able to store 1mb Value. https://docs.djangoproject.com/en/dev/topics/cache/#memcached If you don't have / want a memcache instance, you can use local memory caching. ( providing a local memory cache for every process running your system. ) https://docs.djangoproject.com/en/dev/topics/cache/#local-memory-caching Then easily do current_xsd = cache.get(xsd_id) if not current_xsd: current_xsd =*load xsd from disk?* cache.set(xsd_id, current_xsd) best regards ludwig Am Sonntag, 9. Dezember 2012 09:05:05 UTC+1 schrieb Dwayne Ghant: > > Hello All, > > I will be short and sweet. I have a simple (well at least I think it's > simple) question. First let me explain, I'm writing a RESTful webservice > that uses validates xml submissions using an xsd (440kb in size), > pre-defined, schema. I would, idealistically, like to bootstrap the schema > into memory so that it's not being requested every time the web service is > requested. What's the best way to do this? A brief google > search yielded the results below ( > http://stackoverflow.com/questions/11159077/python-load-2gb-of-text-file-to-memory > ): > > import mmap > with open('dump.xml', 'rb') as f: > # Size 0 will read the ENTIRE file into memory! > m = mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ) #File is open read-only > > # Proceed with your code here -- note the file is already in memory > # so "readine" here will be as fast as could be > data = m.readline() > while data: > # Do stuff > data = m.readline() > > > Will this work? Will this make the file only load once into memory? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/e0qb_d1qFk8J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.