##// END OF EJS Templates
Show cache keys in admin settings of repository
marcink -
r2809:070d2eac beta
parent child Browse files
Show More
@@ -446,6 +446,7 b' def repo2db_mapper(initial_repo_list, re'
446 # during starting install all cache keys for all repositories in the
446 # during starting install all cache keys for all repositories in the
447 # system, this will register all repos and multiple instances
447 # system, this will register all repos and multiple instances
448 key, _prefix, _org_key = CacheInvalidation._get_key(name)
448 key, _prefix, _org_key = CacheInvalidation._get_key(name)
449 log.debug("Creating cache key for %s instance_id:`%s`" % (name, _prefix))
449 CacheInvalidation._get_or_create_key(key, _prefix, _org_key, commit=False)
450 CacheInvalidation._get_or_create_key(key, _prefix, _org_key, commit=False)
450 sa.commit()
451 sa.commit()
451 removed = []
452 removed = []
@@ -746,6 +746,16 b' class Repository(Base, BaseModel):'
746 p += self.repo_name.split(Repository.url_sep())
746 p += self.repo_name.split(Repository.url_sep())
747 return os.path.join(*p)
747 return os.path.join(*p)
748
748
749 @property
750 def cache_keys(self):
751 """
752 Returns associated cache keys for that repo
753 """
754 return CacheInvalidation.query()\
755 .filter(CacheInvalidation.cache_args == self.repo_name)\
756 .order_by(CacheInvalidation.cache_key)\
757 .all()
758
749 def get_new_name(self, repo_name):
759 def get_new_name(self, repo_name):
750 """
760 """
751 returns new full repository name based on assigned group and new new
761 returns new full repository name based on assigned group and new new
@@ -1402,6 +1412,13 b' class CacheInvalidation(Base, BaseModel)'
1402 return u"<%s('%s:%s')>" % (self.__class__.__name__,
1412 return u"<%s('%s:%s')>" % (self.__class__.__name__,
1403 self.cache_id, self.cache_key)
1413 self.cache_id, self.cache_key)
1404
1414
1415 @property
1416 def prefix(self):
1417 _split = self.cache_key.split(self.cache_args, 1)
1418 if _split and len(_split) == 2:
1419 return _split[0]
1420 return ''
1421
1405 @classmethod
1422 @classmethod
1406 def clear_cache(cls):
1423 def clear_cache(cls):
1407 cls.query().delete()
1424 cls.query().delete()
@@ -188,6 +188,20 b''
188 <div class="form">
188 <div class="form">
189 <div class="fields">
189 <div class="fields">
190 ${h.submit('reset_cache_%s' % c.repo_info.repo_name,_('Invalidate repository cache'),class_="ui-btn",onclick="return confirm('"+_('Confirm to invalidate repository cache')+"');")}
190 ${h.submit('reset_cache_%s' % c.repo_info.repo_name,_('Invalidate repository cache'),class_="ui-btn",onclick="return confirm('"+_('Confirm to invalidate repository cache')+"');")}
191 <div class="field" style="border:none;color:#888">
192 <ul>
193 <li>${_('Manually invalidate cache for this repository. On first access repository will be cached again')}
194 </li>
195 </ul>
196 </div>
197 <div class="field" style="border:none;">
198 ${_('List of cached values')}
199 <ul>
200 %for cache in c.repo_info.cache_keys:
201 <li>INSTANCE ID:${cache.prefix or '-'} ${cache.cache_args} CACHED: ${h.bool2icon(cache.cache_active)}</li>
202 %endfor
203 </ul>
204 </div>
191 </div>
205 </div>
192 </div>
206 </div>
193 ${h.end_form()}
207 ${h.end_form()}
@@ -195,20 +209,20 b''
195 <h3>${_('Public journal')}</h3>
209 <h3>${_('Public journal')}</h3>
196 ${h.form(url('repo_public_journal', repo_name=c.repo_info.repo_name),method='put')}
210 ${h.form(url('repo_public_journal', repo_name=c.repo_info.repo_name),method='put')}
197 <div class="form">
211 <div class="form">
198 ${h.hidden('auth_token',str(h.get_token()))}
212 ${h.hidden('auth_token',str(h.get_token()))}
199 <div class="field">
213 <div class="field">
200 %if c.in_public_journal:
214 %if c.in_public_journal:
201 ${h.submit('set_public_%s' % c.repo_info.repo_name,_('Remove from public journal'),class_="ui-btn")}
215 ${h.submit('set_public_%s' % c.repo_info.repo_name,_('Remove from public journal'),class_="ui-btn")}
202 %else:
216 %else:
203 ${h.submit('set_public_%s' % c.repo_info.repo_name,_('Add to public journal'),class_="ui-btn")}
217 ${h.submit('set_public_%s' % c.repo_info.repo_name,_('Add to public journal'),class_="ui-btn")}
204 %endif
218 %endif
205 </div>
219 </div>
206 <div class="field" style="border:none;color:#888">
220 <div class="field" style="border:none;color:#888">
207 <ul>
221 <ul>
208 <li>${_('All actions made on this repository will be accessible to everyone in public journal')}
222 <li>${_('All actions made on this repository will be accessible to everyone in public journal')}
209 </li>
223 </li>
210 </ul>
224 </ul>
211 </div>
225 </div>
212 </div>
226 </div>
213 ${h.end_form()}
227 ${h.end_form()}
214
228
General Comments 0
You need to be logged in to leave comments. Login now