Fix caching issues of cython magic.

Should fix https://github.com/ipython/ipython/issues/6507 when using cython magic. 
We will deprecate cython magic in IPython itself.
Merge pull request #322 from Carreau/patch-1

Fix caching issues of cython magic.