title: BreezeJS: Indexed Cache
body: <p>I'm working on a SPA utilising BreezeJS and AngularJS, handling lots of entities (one of the types has ~60k entities). This is not an ordinary website, it's made for a specific purpose.</p>
  
  <p>Most of the time the entities are shown in sortable, paged lists.</p>
  
  <p>The above mentioned mass of entities gets cached and queried in a worker thread, so that the UI doesn't get blocked. We want to keep client-server communication to a minimum after application initialisation, hence the need for caching lots of data.</p>
  
  <p>The results from the <code>entityManager</code> in the worker thread get imported to the <code>entityManager</code> in the UI thread and further processing follows. This all works fine, my only problem is that performing an <code>orderBy</code> on such a huge dataset takes too long for Breeze to complete (2.5-3.5 secs) without indexes.</p>
  
  <p>This means that showing the next page is unacceptably slow if ordering is in place.</p>
  
  <ul>
  <li>Is there a way to equip the Breeze cache with indexes and get Breeze to use them somehow?</li>
  <li>If not, is this feature planned to be implemented?</li>
  </ul>
  
  <p>I could of course craft indexes for this particular model and amend the query to be run against the cache, but it wouldn't be easy to maintain, considering the dataset is allowed to change.</p>