CustomCacheMediator.lua 768 B

1234567891011121314151617181920212223242526
  1. local DebugMediator = requireMediator("DebugMediator")
  2. local CustomCacheMediator = class("CustomCacheMediator", DebugMediator)
  3. CustomCacheMediator.NAME = "CustomCacheMediator"
  4. function CustomCacheMediator:ctor()
  5. CustomCacheMediator.super.ctor(self)
  6. end
  7. function CustomCacheMediator:listNotificationInterests()
  8. local noticeTable = global.NoticeTable
  9. return {
  10. noticeTable.ReleaseMemory
  11. }
  12. end
  13. function CustomCacheMediator:handleNotification(notification)
  14. local noticeName = notification:getName()
  15. local noticeTable = global.NoticeTable
  16. local noticeData = notification:getBody()
  17. if noticeName == noticeTable.ReleaseMemory then
  18. global.CustomCache:Clear()
  19. end
  20. end
  21. return CustomCacheMediator