当前位置: 首页>>代码示例>>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;未经允许,请勿转载。