block5.go 496 B

1234567891011121314151617181920212223
  1. package cblocks
  2. import (
  3. "html/template"
  4. )
  5. func (this *CacheBlocks) GetBlock5(host, url string) (template.HTML, bool) {
  6. this.Lock()
  7. defer this.Unlock()
  8. if mapCache, ok := this.cacheBlocks[host]; ok {
  9. if data, ok := mapCache.CacheBlock5[url]; ok {
  10. return data, ok
  11. }
  12. }
  13. return template.HTML(""), false
  14. }
  15. func (this *CacheBlocks) SetBlock5(host, url string, data template.HTML) {
  16. this.Lock()
  17. defer this.Unlock()
  18. this.prepare(host)
  19. this.cacheBlocks[host].CacheBlock5[url] = data
  20. }