def _cached_topic_story_list(user_mc_key, topics_id, **kwargs): ''' Internal helper - don't call this; call topic_story_list instead. This needs user_mc_key in the function signature to make sure the caching is keyed correctly. ''' local_mc = base_cache.mc_client(user_mc_key) return local_mc.topicStoryList(topics_id, **kwargs)
def _cached_word_count(api_key, q, fq, ngram_size, num_words, sample_size): local_mc = base_cache.mc_client() return local_mc.wordCount(q, fq, ngram_size=ngram_size, num_words=num_words, sample_size=sample_size)
def _cached_most_used_tags(api_key, q, fq, tag_sets_id, sample_size=None): # top tags used in stories matching query # api_key used for caching at the user level local_mc = base_cache.mc_client() return local_mc.storyTagCount(q, fq, tag_sets_id=tag_sets_id, limit=sample_size)
def _cached_story_list_page(api_key, q, fq, last_processed_stories_id, stories_per_page, sort): # be user-specific in this cache to be careful about permissions on stories # api_key passed in just to make this a user-level cache local_client = base_cache.mc_client() return local_client.storyList( q, fq, last_processed_stories_id=last_processed_stories_id, rows=stories_per_page, sort=sort)
def _cached_topic_media_link_list_page(user_mc_key, topics_id, link_id, **kwargs): # api_key passed in just to make this a user-level cache local_mc = base_cache.mc_client(user_mc_key) return local_mc.topicMediaLinks(topics_id, link_id=link_id, **kwargs)
def _cached_topic_story_list_page(user_mc_key, topics_id, link_id, **kwargs): # be user-specific in this cache to be careful about permissions on stories # api_key passed in just to make this a user-level cache local_mc = base_cache.mc_client(user_mc_key) return local_mc.topicStoryList(topics_id, link_id=link_id, **kwargs)
def cached_story_split_count(mc_api_key, q, fq): local_mc = base_cache.mc_client() results = local_mc.storyCount(q, fq, split=True) return results
def _cached_tag_set(api_key, tag_sets_id): local_mc = base_cache.mc_client() return local_mc.tagSet(tag_sets_id)
def _cached_total_story_count(api_key, q, fq): # api_key is included to keep the cache at the user-level local_mc = base_cache.mc_client() count = local_mc.storyCount(q, fq) return count
def _cached_story_list_page(api_key, q, fq, last_processed_stories_id, stories_per_page, sort): # be user-specific in this cache to be careful about permissions on stories # api_key passed in just to make this a user-level cache local_client = base_cache.mc_client() return local_client.storyList(q, fq, last_processed_stories_id=last_processed_stories_id, rows=stories_per_page, sort=sort)