(userID int64)
| 54 | } |
| 55 | |
| 56 | func GetPostsCache(userID int64) *[]PublicPost { |
| 57 | userPostsCache.RLock() |
| 58 | pci, ok := userPostsCache.users[userID] |
| 59 | userPostsCache.RUnlock() |
| 60 | if !ok { |
| 61 | return nil |
| 62 | } |
| 63 | |
| 64 | if pci.Expire.Before(time.Now()) { |
| 65 | // Cache is expired |
| 66 | return nil |
| 67 | } |
| 68 | return pci.Posts |
| 69 | } |