Added a basic caching mechanism.

- Cache replaces any empty slots with a missed value.
- Adjusted .gitignore and removed irrelevant .pyc files.