示例#1
0
文件: tumblr.py 项目: bcorrigan/Goat
def cache_url(url):
    """Adds a url to the cache.  Returns True if we've seen it before or False
if it's new."""
    url_store = KVStore.getCustomStore("tumblr_urls")
    if url_store.has(url):
        return True
    else:
        url_store.save(url, time.time())
    return False
示例#2
0
文件: tumblr.py 项目: bcorrigan/Goat
def cache_url(url):
    """Adds a url to the cache.  Returns True if we've seen it before or False
if it's new."""
    url_store = KVStore.getCustomStore("tumblr_urls")
    if url_store.has(url):
        return True
    else:
        url_store.save(url, time.time())
    return False
示例#3
0
文件: tumblr.py 项目: bcorrigan/Goat
def cache_search(search):
    """Adds a search to the cache.  Returns True if we've seen it before or
False if it's new."""
    tokens = re.sub("[^a-z\s]", "", search.lower()).split()
    key = " ".join(sorted(tokens))

    search_store = KVStore.getCustomStore("tumblr_searches")
    if search_store.has(key):
        return True
    else:
        search_store.save(key, time.time())
    return False
示例#4
0
文件: tumblr.py 项目: bcorrigan/Goat
def cache_search(search):
    """Adds a search to the cache.  Returns True if we've seen it before or
False if it's new."""
    tokens = re.sub("[^a-z\s]", "", search.lower()).split()
    key = " ".join(sorted(tokens))

    search_store = KVStore.getCustomStore("tumblr_searches")
    if search_store.has(key):
        return True
    else:
        search_store.save(key, time.time())
    return False
示例#5
0
文件: tumblr.py 项目: bcorrigan/Goat
def set_last_post_time():
    store = KVStore.getCustomStore("tumblr")
    now = time.time()
    last_post = store.save("lastPost", now)
    return now
示例#6
0
文件: tumblr.py 项目: bcorrigan/Goat
def get_last_post_time():
    store = KVStore.getCustomStore("tumblr")
    last_post = store.getOrElse("lastPost", 0.0)
    return last_post
示例#7
0
文件: tumblr.py 项目: bcorrigan/Goat
def get_tumblr_store():
    store = KVStore.getCustomStore("tumblr")
    return store
示例#8
0
文件: tumblr.py 项目: bcorrigan/Goat
def set_last_post_time():
    store = KVStore.getCustomStore("tumblr")
    now = time.time()
    last_post = store.save("lastPost", now)
    return now
示例#9
0
文件: tumblr.py 项目: bcorrigan/Goat
def get_last_post_time():
    store = KVStore.getCustomStore("tumblr")
    last_post = store.getOrElse("lastPost", 0.0)
    return last_post
示例#10
0
文件: tumblr.py 项目: bcorrigan/Goat
def get_tumblr_store():
    store = KVStore.getCustomStore("tumblr")
    return store