Read attempts to retrieve a cached value as a string, if the value does not exists returns an empty string and false.
(h Hashable)
| 77 | // Read attempts to retrieve a cached value as a string, if the value does not |
| 78 | // exists returns an empty string and false. |
| 79 | func (c *Cache) Read(h Hashable) (string, bool) { |
| 80 | if v, ok := c.ReadRaw(h); ok { |
| 81 | if s, ok := v.(string); ok { |
| 82 | return s, true |
| 83 | } |
| 84 | } |
| 85 | return "", false |
| 86 | } |
| 87 | |
| 88 | // ReadRaw attempts to retrieve a cached value as an interface{}, if the value |
| 89 | // does not exists returns nil and false. |