Update cache.py

"from cStringIO import StringIO" breaks in python 3.3
replaced with:
"try:
    from cStringIO import StringIO
except ImportError as e:
    from io import StringIO"