Add some stuff to .gitingore
Make per-window object caching DRY and thread-safe