Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Further improvements to the /cachestat page. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3af3ffdf443e77e35b639f4d4dadbf26 |
User & Date: | drh 2025-04-09 13:07:49.063 |
Context
2025-04-09
| ||
22:37 | If /chat's poller cannot connect to the server, apply a back-off timer so that it does not keep hammering the remote every single second. It attempts to inform the user about outages and when reconnection has succeeded, but it's difficult to test the timing of the the UI elements thoroughly with a single pair of hands, so this is being checked in for dogfooding. ... (check-in: 2debc54e user: stephan tags: chat-backoff-timer) | |
21:12 | Do not allow integer left-shift overflow in TH1, because gcc 14.2.0 hates that. Forum post 6c1653220. ... (check-in: c66b1967 user: drh tags: trunk) | |
13:07 | Further improvements to the /cachestat page. ... (check-in: 3af3ffdf user: drh tags: trunk) | |
12:25 | More administrative functions related to the Web Cache are now available on the /cachestat page. ... (check-in: cfb716fb user: drh tags: trunk) | |
Changes
Changes to src/cache.c.
︙ | ︙ | |||
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | ** ** Show information about the webpage cache. Requires Setup privilege. */ void cache_page(void){ sqlite3 *db = 0; sqlite3_stmt *pStmt; int doInit; char zBuf[100]; login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); return; } style_set_current_feature("cache"); style_header("Web Cache Status"); doInit = P("init")!=0 && cgi_csrf_safe(2); db = cacheOpen(doInit); | > > > > | < < < < < < < < < | < > > > > | | | | > | | < < < < < > > | | | | | | > | > > > > > > | | > | | | | < | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 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 483 484 485 486 487 488 | ** ** Show information about the webpage cache. Requires Setup privilege. */ void cache_page(void){ sqlite3 *db = 0; sqlite3_stmt *pStmt; int doInit; char *zDbName = cacheName(); int nEntry = 0; int mxEntry = 0; char zBuf[100]; login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); return; } style_set_current_feature("cache"); style_header("Web Cache Status"); style_submenu_element("Refresh","%R/cachestat"); doInit = P("init")!=0 && cgi_csrf_safe(2); db = cacheOpen(doInit); if( db!=0 ){ if( P("clear")!=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 ){ while( sqlite3_step(pStmt)==SQLITE_ROW ){ const unsigned char *zName = sqlite3_column_text(pStmt,0); char *zHash = cache_hash_of_key((const char*)zName); if( nEntry==0 ){ @ <h2>Current Cache Entries:</h2> @ <ol> } @ <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))Z \ if( zHash ){ @ → %z(href("%R/timeline?c=%S",zHash))checkin info</a>\ fossil_free(zHash); } @ </p></li> nEntry++; } sqlite3_finalize(pStmt); if( nEntry ){ @ </ol> } } } @ <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"> login_insert_csrf_secret(); @ <ul> if( db==0 ){ @ <li> Web-cache is currently disabled. @ <input type="submit" name="init" value="Enable"> }else{ bigSizeName(sizeof(zBuf), zBuf, file_size(zDbName, ExtFILE)); mxEntry = db_get_int("max-cache-entry",10); @ <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 cache entries used: %d(nEntry) @ <li> Change the max-cache-entry setting on the @ <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); if( db ) sqlite3_close(db); style_finish_page(); } /* ** WEBPAGE: cacheget ** ** Usage: /cacheget?key=KEY |
︙ | ︙ |