statistics(); $timestamp = now()->getTimestamp(); foreach ($stats as $key => $value) { $cacheKey = "nodes.{$node->id}.$key"; $data = cache()->get($cacheKey, []); // Add current timestamp and value to the data array $data[$timestamp] = $value; // Update the cache with the new data, expires in 1 minute cache()->put($cacheKey, $data, now()->addMinute()); } } } }