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]

Transpiled version (34L) is out of date.

// 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/24.0) true; // keep all backups within last hour
  if (age <= 0.5 && age >= lastAge+1/24.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/6
Text MD5: e8bc772c172af3664c489f51bee23142
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2025-04-20 16:48:16
Source code size: 592 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 490
Version history: 5 change(s)
Referenced in: [show references]