Skip to content

Maintenance Guide

Last Updated: 2026-02-03 | Reading Time: 10 minutes

Regular maintenance procedures for PasteShelf.



  • Sync status check
  • Expired item cleanup
  • Search index optimization
  • Database vacuum
  • Log rotation
  • Cache cleanup
  • Full backup verification
  • Storage usage review
  • Performance analysis

class DatabaseMaintenance {
func performMaintenance() async {
// 1. Clean up deleted items
await cleanupDeletedItems()
// 2. Optimize search index
await optimizeSearchIndex()
// 3. Compact database
await compactDatabase()
}
func cleanupDeletedItems() async {
let context = persistenceController.container.newBackgroundContext()
await context.perform {
let fetchRequest: NSFetchRequest<NSFetchRequestResult> = ClipboardItem.fetchRequest()
fetchRequest.predicate = NSPredicate(format: "isDeleted == YES AND deletedAt < %@",
Date().addingTimeInterval(-7 * 24 * 60 * 60) as NSDate)
let deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)
try? context.execute(deleteRequest)
}
}
}
Terminal window
# Manual SQLite optimization (if needed)
sqlite3 ~/Library/Application\ Support/PasteShelf/PasteShelf.sqlite "VACUUM;"
sqlite3 ~/Library/Application\ Support/PasteShelf/PasteShelf.sqlite "ANALYZE;"

func cleanupStorage() async {
// Remove orphaned files
let contentDir = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)
.first!.appendingPathComponent("PasteShelf/Content")
let storedFiles = try? FileManager.default.contentsOfDirectory(at: contentDir, includingPropertiesForKeys: nil)
let referencedFiles = await getReferencedFileIds()
for file in storedFiles ?? [] {
let fileId = file.deletingPathExtension().lastPathComponent
if !referencedFiles.contains(fileId) {
try? FileManager.default.removeItem(at: file)
}
}
}
Terminal window
# Check storage usage
du -sh ~/Library/Application\ Support/PasteShelf/
# Clear cache
rm -rf ~/Library/Caches/com.pasteshelf.PasteShelf/

  1. Backup clipboard history
  2. Check system requirements
  3. Close PasteShelf
  1. Verify license activation
  2. Check sync status
  3. Test core functionality

DocumentDescription
Monitoring & LoggingSystem monitoring
TroubleshootingCommon issues

Last updated: 2026-02-03