當前位置: 首頁>>代碼示例>>Python>>正文


Python Project.touch_cache方法代碼示例

本文整理匯總了Python中agilito.models.Project.touch_cache方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.touch_cache方法的具體用法?Python Project.touch_cache怎麽用?Python Project.touch_cache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在agilito.models.Project的用法示例。


在下文中一共展示了Project.touch_cache方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: touch_cache

# 需要導入模塊: from agilito.models import Project [as 別名]
# 或者: from agilito.models.Project import touch_cache [as 別名]
def touch_cache(request, project_id):
    response = HttpResponse(mimetype="text/plain")
    if CACHE_ENABLED:
        Project.touch_cache(project_id)
        response.write("Touched cache for project %s\n" % project_id)
        response.write("CACHE_PREFIX=%s\n" % CACHE_PREFIX)
    else:
        response.write("Caching is disabled")
    return response
開發者ID:httpdss,項目名稱:ajellito,代碼行數:11,代碼來源:tools.py

示例2: invalidate_cache

# 需要導入模塊: from agilito.models import Project [as 別名]
# 或者: from agilito.models.Project import touch_cache [as 別名]
def invalidate_cache(sender, instance, **kwargs):
    from agilito.models import Project
    ids = []

    if isinstance(instance, User):
        ids = [p.id for p in instance.project_set.all()]
    elif hasattr(instance, 'project'):
        ids = [instance.project.id]

    for id in ids:
        
        Project.touch_cache(id)
開發者ID:mreperger,項目名稱:ajellito,代碼行數:14,代碼來源:utils.py

示例3: call

# 需要導入模塊: from agilito.models import Project [as 別名]
# 或者: from agilito.models.Project import touch_cache [as 別名]
os.chdir(BACKLOG_ARCHIVE)

call('git add .')
call('git commit -a -m "%s"' % datetime.date.today().isoformat())

from django.db import connection, transaction
cursor = connection.cursor()

cursor.execute('delete from agilito_archivedbacklog')
id = 0

projects = []
repo = Repo(BACKLOG_ARCHIVE)
for commit in repo.revision_history(repo.head()):
    for mode, name, sha in repo.tree(commit.tree).entries():
        m = re.match('([0-9]+)[.]ods$', name)
        if not m:
            continue

        project_id = int(m.group(1))
        if not project_id in projects:
            projects.append(project_id)

        id += 1
        cursor.execute("""  insert into agilito_archivedbacklog (id, stamp, project_id, commit)
                            values (%s, %s, %s, %s)""", (id, datetime.datetime.fromtimestamp(commit.commit_time), project_id, commit.tree))

transaction.commit_unless_managed()
for project_id in projects:
    Project.touch_cache(project_id)
開發者ID:httpdss,項目名稱:ajellito,代碼行數:32,代碼來源:archiver.py


注:本文中的agilito.models.Project.touch_cache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。