# Cache & ประสิทธิภาพ (Symfony) > Cache pools, adapters, tags, การล้างค่า cache, HTTP cache, ESI, การผสานรวม Varnish - 20 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions.md) ## 1. Symfony ใช้ interface ใดในการ implement ระบบ cache PSR-6? **คำตอบ** Symfony implement มาตรฐาน PSR-6 ผ่าน CacheItemPoolInterface โดย interface นี้กำหนดเมธอด getItem(), hasItem(), deleteItem(), save() และ clear() สำหรับจัดการ cache item ส่วนประกอบ Cache ของ Symfony มี adapter หลายตัว (Redis, Memcached, Filesystem ฯลฯ) ที่ implement interface นี้ทั้งหมด เพื่อรับประกันการทำงานร่วมกับไลบรารี PHP อื่นที่รองรับ PSR-6 ## 2. cache adapter เริ่มต้นที่กำหนดค่าไว้ใน Symfony สำหรับสภาพแวดล้อม development คืออะไร? **คำตอบ** ในสภาพแวดล้อม development Symfony ใช้ ArrayAdapter เป็นค่าเริ่มต้นซึ่งเก็บ cache ไว้ในหน่วยความจำ cache นี้ไม่คงอยู่ระหว่าง request ซึ่งเหมาะอย่างยิ่งสำหรับการพัฒนาเพราะหลีกเลี่ยงปัญหา cache ล้าสมัยเมื่อแก้ไขโค้ด ในสภาพแวดล้อม production แนะนำให้ใช้ adapter ที่คงอยู่อย่าง Redis หรือ Memcached เพื่อประสิทธิภาพที่ดีกว่า ## 3. จะสร้าง cache pool แบบกำหนดเองในการตั้งค่า Symfony ได้อย่างไร? **คำตอบ** cache pool แบบกำหนดเองถูกกำหนดไว้ภายใต้คีย์ framework.cache.pools ในการตั้งค่า แต่ละ pool สามารถระบุ adapter ของตน อายุการใช้งานเริ่มต้น (default_lifetime) และ tags เพิ่มเติมได้ ตัวอย่างเช่น pool 'app.cache.products' ที่ใช้ RedisAdapter ช่วยให้จัดการ cache ของสินค้าได้อย่างอิสระจากข้อมูลอื่น ทำให้การ invalidate แบบเจาะจงทำได้ง่ายขึ้น ## มีอีก 17 คำถาม - ควรใช้เมธอดใดในการดึงค่าจาก cache พร้อม callback สำหรับคำนวณหากไม่มีค่าอยู่? - ข้อได้เปรียบหลักของ cache tags ใน Symfony คืออะไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Symfony อื่นๆ - [PHP สมัยใหม่ (8.1+)](https://sharpskill.dev/th/technologies/symfony/interview-questions/php-modern-features.md): 20 คำถาม, Junior - [พื้นฐาน Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/symfony-basics.md): 25 คำถาม, Junior - [Routing & Controllers](https://sharpskill.dev/th/technologies/symfony/interview-questions/routing-controllers.md): 20 คำถาม, Junior - [Twig & Templates](https://sharpskill.dev/th/technologies/symfony/interview-questions/twig-templates.md): 20 คำถาม, Junior - [พื้นฐาน Doctrine ORM](https://sharpskill.dev/th/technologies/symfony/interview-questions/doctrine-orm-basics.md): 25 คำถาม, Junior - [ฟอร์ม Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/forms.md): 22 คำถาม, Junior - [การตรวจสอบความถูกต้องของข้อมูล](https://sharpskill.dev/th/technologies/symfony/interview-questions/validation.md): 18 คำถาม, Junior - [Dependency Injection & Services](https://sharpskill.dev/th/technologies/symfony/interview-questions/dependency-injection.md): 24 คำถาม, Mid-Level - [Security & Authentication](https://sharpskill.dev/th/technologies/symfony/interview-questions/security-authentication.md): 26 คำถาม, Mid-Level - [Doctrine ขั้นสูง](https://sharpskill.dev/th/technologies/symfony/interview-questions/doctrine-advanced.md): 24 คำถาม, Mid-Level - [API Platform](https://sharpskill.dev/th/technologies/symfony/interview-questions/api-platform.md): 22 คำถาม, Mid-Level - [Serializer Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/serializer.md): 20 คำถาม, Mid-Level - [Events & Event Subscribers](https://sharpskill.dev/th/technologies/symfony/interview-questions/events-subscribers.md): 20 คำถาม, Mid-Level - [Console & Commands](https://sharpskill.dev/th/technologies/symfony/interview-questions/console-commands.md): 18 คำถาม, Mid-Level - [Messenger Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/messenger.md): 22 คำถาม, Mid-Level - [HTTP Client](https://sharpskill.dev/th/technologies/symfony/interview-questions/http-client.md): 18 คำถาม, Mid-Level - [Workflow Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/workflow.md): 18 คำถาม, Mid-Level - [Testing Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/testing.md): 22 คำถาม, Mid-Level - [Mailer Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/mailer.md): 16 คำถาม, Mid-Level - [การแปลและ i18n](https://sharpskill.dev/th/technologies/symfony/interview-questions/translations.md): 16 คำถาม, Mid-Level - [EasyAdmin Bundle](https://sharpskill.dev/th/technologies/symfony/interview-questions/easyadmin.md): 18 คำถาม, Mid-Level - [สถาปัตยกรรม Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/architecture-patterns.md): 24 คำถาม, Senior - [ประสิทธิภาพและการเพิ่มประสิทธิภาพ](https://sharpskill.dev/th/technologies/symfony/interview-questions/performance-optimization.md): 22 คำถาม, Senior - [ความปลอดภัยขั้นสูง](https://sharpskill.dev/th/technologies/symfony/interview-questions/security-advanced.md): 22 คำถาม, Senior - [Custom Bundles](https://sharpskill.dev/th/technologies/symfony/interview-questions/custom-bundles.md): 20 คำถาม, Senior - [Microservices ด้วย Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/microservices.md): 22 คำถาม, Senior - [Real-time & WebSockets](https://sharpskill.dev/th/technologies/symfony/interview-questions/real-time.md): 18 คำถาม, Senior - [Deployment & DevOps](https://sharpskill.dev/th/technologies/symfony/interview-questions/deployment-devops.md): 20 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/symfony/interview-questions/cache