Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8862605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:46:06+00:00 2026-06-14T15:46:06+00:00

i just started working with ZF2 … i want to initialize cache and session

  • 0

i just started working with ZF2 …
i want to initialize cache and session in config file and be able too use it in the application ( every where ) either using service manager or … i have been searching Google for hours with no lock … couldn’t find anything useful in the documentations and …

i tried this in module.config.php(Application module):

'service_manager' => array(
        'factories' => array(
            'cache' => '\Zend\Cache\StorageFactory',
        ),
    ),
    'cache' => array(
        'storage' => array(
            'adapter' => 'Filesystem',
            'options' => array(
                'cache_dir' => __DIR__ . '/../../../data/cache'
            ),
        ),
        'plugins' => array('WriteControl', 'IgnoreUserAbort'),
        'options' => array(
            'removeOnFailure' => true,
            'exitOnAbort' => true,
            'ttl' => 100
        ),
    ),

i got this error : While attempting to create cache(alias: cache) an invalid factory was registered for this instance type.
so whats the valid factory ?
so any one can help me out here ?
tanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:46:07+00:00Added an answer on June 14, 2026 at 3:46 pm

    Use a closure as factory instead because Zend\Cache\StorageFactory doesn’t implement Zend\ServiceManager\FactoryInterface

    'service_manager' => array(
        'factories' => array(
            'cache' => function () {
                return Zend\Cache\StorageFactory::factory(array(
                    'storage' => array(
                        'adapter' => 'Filesystem',
                        'options' => array(
                            'cache_dir' => __DIR__ . '/../../../data/cache',
                            'ttl' => 100
                        ),
                    ),
                    'plugins' => array(
                        'IgnoreUserAbort' => array(
                            'exitOnAbort' => true
                        ),
                    ),
                ));
            },
        ),
    )
    

    Btw. clean up your cache configuration and where you get the plugin in WriteControl and the option removeOnFailure from?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started working with DBpedia and SPARQL. I want to use it as
I just started working on an asp.net / C#.net application that is going to
I just started working on upgrading a small component in a distributed java application.
I have just started working on localization of this application. Starting with three tab
I just started working on an eclipse RCP application in my company and search
I just started working with Drupal for a while and decided to use this
I just started working with VB.NET. In my application I will need to have
I just started working on a new Eclipse Android project and want to make
I just started working with ASP.NET and Visual Studio 2008. I want to create
I just started working on a sample application that only calls some tables on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.