def collection_browse(): if cache.get('collection-browse') is None: sq = SidebarBuilder() cache.set('collection-browse', sq.get_collections(), 500) return {'collections':cache.get('collection-browse'), 'collection_count':len(cache.get('collection-browse'))}