update to cache meganism (now returns the file pointer, so the programmer can choose his own wrapper to read it)