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/-/wjh2I1m9o2kJ. 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.