Method
create_node
(&self, key: String, value: Bytes)
Source from the content-addressed store, hash-verified
| 140 | } |
| 141 | |
| 142 | fn create_node(&self, key: String, value: Bytes) -> Rc<RefCell<CacheItem>> { |
| 143 | let expires_at = if self.ttl < 1 { |
| 144 | CacheItemTTL::Persist |
| 145 | } else { |
| 146 | CacheItemTTL::ExpiresAfterSeconds(self.ttl) |
| 147 | }; |
| 148 | Rc::new(RefCell::new(CacheItem { |
| 149 | last_access: Instant::now(), |
| 150 | key: key.clone(), |
| 151 | value: value.clone(), |
| 152 | expires_at, |
| 153 | prev: None, |
| 154 | next: None, |
| 155 | })) |
| 156 | } |
| 157 | } |
Tested by
no test coverage detected