Sequenzia/app/models/Tag/CacheMethods.php

26 lines
607 B
PHP
Raw Normal View History

2013-10-27 01:06:58 +02:00
<?php
namespace Tag;
use Rails;
use Moebooru;
trait CacheMethods
{
protected function update_cache()
{
# iTODO: hash keys
2013-11-08 17:37:29 +01:00
Rails::cache()->write('tag_type.' . $this->name, self::type_name_from_value($this->tag_type));
2013-10-27 01:06:58 +02:00
# Expire the tag cache if a tag's type changes.
if ($this->tag_type != $this->tagTypeWas()) {
Moebooru\CacheHelper::expire_tag_version();
}
}
# Expire the tag cache when a new tag is created.
protected function update_cache_on_create()
{
Moebooru\CacheHelper::expire_tag_version();
}
}