416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
+
+
+
+
+
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
|
@ <form method="post">
login_insert_csrf_secret();
@ The web-page cache is disabled for this repository
@ <input type="submit" name="init" value="Enable">
@ </form>
}else{
char *zDbName = cacheName();
int nEntry = 0;
int mxEntry = 0;
if( P("clearcache")!=0 && cgi_csrf_safe(2) ){
sqlite3_exec(db, "DELETE FROM cache; DELETE FROM blob; VACUUM;",0,0,0);
}
cache_register_sizename(db);
pStmt = cacheStmt(db,
"SELECT key, sz, nRef, datetime(tm,'unixepoch')"
" FROM cache"
" ORDER BY (tm + 3600*min(nRef,48)) DESC"
);
if( pStmt ){
@ <ol>
while( sqlite3_step(pStmt)==SQLITE_ROW ){
const unsigned char *zName = sqlite3_column_text(pStmt,0);
char *zHash = cache_hash_of_key((const char*)zName);
@ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br>
@ size: %,lld(sqlite3_column_int64(pStmt,1))
@ hit-count: %d(sqlite3_column_int(pStmt,2))
@ last-access: %s(sqlite3_column_text(pStmt,3)) \
if( zHash ){
@ %z(href("%R/timeline?c=%S",zHash))check-in</a>\
fossil_free(zHash);
}
@ </p></li>
nEntry++;
}
sqlite3_finalize(pStmt);
@ </ol>
}
zDbName = cacheName();
bigSizeName(sizeof(zBuf), zBuf, file_size(zDbName, ExtFILE));
mxEntry = db_get_int("max-cache-entry",10);
@ <p>
@ cache-file name: %h(zDbName)<br>
@ cache-file size: %s(zBuf)<br>
@ max-cache-entry: %d(db_get_int("max-cache-entry",10))
@ </p>
@ <h2>About The Web-Cache</h2>
@ <p>
@ The web-cache is a separate database file that holds cached copies
@ tarballs, ZIP archives, and other pages that are expensive to compute
@ and are likely to be reused.
@ <form method="post">
@ <ul>
@ <li> Filename of the cache database: <b>%h(zDbName)</b>
@ <li> Size of the cache database: %s(zBuf)
@ <li> Maximum number of entries: %d(mxEntry);
@ <li> Number of slots used: %d(nEntry)
@ <li> Change the max-cache-entry setting on the
@ Use the "<a href="%R/help?cmd=cache">fossil cache</a>" command
@ on the command-line to create and configure the web-cache.
@ </p>
@ <a href="%R/setup_settings">Settings</a> page to adjust the
@ maximum number of entries in the cache.
@ <li><input type="submit" name="clear" value="Clear the cache">
@ <li> Disable the cache by manually deleting the cache database file.
@ </ul>
@ </form>
fossil_free(zDbName);
sqlite3_close(db);
}
style_finish_page();
}
/*
|