Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
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
Ejemplo n.º 9
0
def _cached_tag_set(api_key, tag_sets_id):
    local_mc = base_cache.mc_client()
    return local_mc.tagSet(tag_sets_id)
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
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)
Ejemplo n.º 12
0
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
Ejemplo n.º 13
0
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)
Ejemplo n.º 14
0
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
Ejemplo n.º 15
0
def _cached_tag_set(api_key, tag_sets_id):
    local_mc = base_cache.mc_client()
    return local_mc.tagSet(tag_sets_id)
Ejemplo n.º 16
0
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)
Ejemplo n.º 17
0
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)
Ejemplo n.º 18
0
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)