1const CACHE_TIME = 600000; 2 3function getCachedData(cacheKey) { 4 try { 5 const cachedData = localStorage.getItem(cacheKey); 6 if (cachedData) { 7 const { data, timestamp } = JSON.parse(cachedData); 8 if (Date.now() - timestamp < CACHE_TIME) return data; 9 } 10 } catch (error) { 11 console.error('Error cache:', error); 12 } 13 return null; 14} 15 16function setCachedData(cacheKey, data) { 17 localStorage.setItem(cacheKey, JSON.stringify({ data, timestamp: Date.now() })); 18} 19 20function formatDateTime(dateString) { 21 const date = new Date(dateString); 22 return { 23 date: date.toLocaleDateString('vi-VN'), 24 time: date.toLocaleTimeString('vi-VN', { hour: '2-digit', minute: '2-digit' }) 25 }; 26} 27for (let i = 0; i < localStorage.length; i++) { 28 let key = localStorage.key(i); 29 let data = localStorage.getItem(key); 30 try { 31 let parsedData = JSON.parse(data); 32 if (parsedData.timestamp) { 33 34 let timestamp = parsedData.timestamp; 35 let currentTime = Date.now(); 36 let thirtyDaysInMillis = 30 * 24 * 60 * 60 * 1000; 37 let timeDifference = currentTime - timestamp; 38 if (timeDifference > thirtyDaysInMillis) { 39 localStorage.removeItem(key); 40 } 41 } 42 } catch (error) { 43 // console.error('Dữ liá»u không hợp lá»: ', error); 44 } 45}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.