PHP Classes

File: src/Modules/Admin/CACHE_LOCATION_UPDATE.md

Recommend this page to a friend!
  Packages of Adrian M   upMVC   src/Modules/Admin/CACHE_LOCATION_UPDATE.md   Download  
File: src/Modules/Admin/CACHE_LOCATION_UPDATE.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: upMVC
Pure PHP web development without other frameworks
Author: By
Last change:
Date: 2 months ago
Size: 3,103 bytes
 

Contents

Class file image Download

Cache Location Update Summary

? Changes Made

The admin module cache has been moved to the system cache directory for better organization.

Old Location

modules/cache/admin_routes.php  ? Module-specific location

New Location

etc/storage/cache/admin_routes.php  ? System cache directory

? Files Updated

1. Routes.php

Changed 3 locations:

// Constructor
$this->cacheFile = __DIR__ . '/../../../etc/storage/cache/admin_routes.php';

// clearCache() method
$cacheFile = __DIR__ . '/../../../etc/storage/cache/admin_routes.php';

// getCacheStats() method
$cacheFile = __DIR__ . '/../../../etc/storage/cache/admin_routes.php';

2. CACHE_TESTING_GUIDE.md

Updated all references from: - modules/cache/admin_routes.php - To: etc/storage/cache/admin_routes.php

? Benefits of New Location

Better Organization

  • ? System-level cache - With other system files
  • ? Centralized - All cache in one place
  • ? Standard structure - Follows common conventions
  • ? Easy backup - Backup entire `etc/storage/` directory

Already Exists

  • ? Directory `etc/storage/cache/` already exists
  • ? No need to create new directories
  • ? Proper permissions already set

Future-Proof

  • ? Room for other module caches
  • ? Can add cache cleaning utilities
  • ? Consistent with upMVC structure

? Cache Directory Structure

etc/
??? storage/
    ??? cache/
        ??? admin_routes.php    ? Admin module route cache
        ??? [other module caches in future]

? Testing the New Location

Verify Directory Exists

ls -la etc/storage/cache/

Clear Old Cache (if exists)

rm -f modules/cache/admin_routes.php

Test New Cache Creation

# 1. Clear new cache location
rm -f etc/storage/cache/admin_routes.php

# 2. Visit admin dashboard (creates cache)
# http://yourdomain.com/admin

# 3. Verify cache created
ls -lh etc/storage/cache/admin_routes.php

# 4. View cache contents
cat etc/storage/cache/admin_routes.php

? Path Breakdown

From modules/admin/routes/Routes.php to cache:

Routes.php location:
  modules/admin/routes/Routes.php

Path traversal:
  __DIR__                          ? modules/admin/routes/
  __DIR__ . '/../../../'           ? (root directory)
  __DIR__ . '/../../../etc/'       ? etc/
  __DIR__ . '/../../../etc/storage/cache/' ? etc/storage/cache/

Final path:
  etc/storage/cache/admin_routes.php  ?

? No Action Required

The cache will automatically be created in the new location when: - You visit the admin dashboard - Routes are loaded for the first time - Cache expires and needs regeneration

? Updated Documentation

All references have been updated in: - ? Routes.php (3 occurrences) - ? CACHE_TESTING_GUIDE.md (all occurrences) - ? This summary document

? Summary

Before:

modules/cache/admin_routes.php

After:

etc/storage/cache/admin_routes.php

Result: Better organized, system-level caching! ?