Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1024349 // defaultAgeBasedBackupRetentionStrategy_shouldKeep

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (34L/1K).

// age = age in days, lastAge = age of last (more recent) file kept (also in days)
sbool defaultAgeBasedBackupRetentionStrategy_shouldKeep(double age, double lastAge) {
  if (age <= 1/12.0) true; // keep all backups within last hour
  if (age <= 0.5 && age >= lastAge+1/12.0) true; // keep hourly backups within last 12 hours
  if (age <= 7 && age >= lastAge+1) true; // keep every daily backup from this week
  if (age <= 28 && age >= lastAge+7) true; // weekly backups for 3 more weeks
  if (age >= lastAge+365.0/12) true; // after 4 weeks, switch to monthly (roundabout)
  false;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1024349
Snippet name: defaultAgeBasedBackupRetentionStrategy_shouldKeep
Eternal ID of this version: #1024349/5
Text MD5: a743307150bf552e9d7ad16c1f2d1729
Transpilation MD5: 99d6f82b83051f540f27cbc563b50470
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-07-13 05:49:31
Source code size: 592 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 293 / 390
Version history: 4 change(s)
Referenced in: [show references]