In order to keep KonaKart running efficiently, expired data should be deleted from the database at regular intervals. If not deleted, the data in some database tables, tends to grow and reduce the overall system performance. A batch job that can be scheduled through Quartz is provided for this task. The name of the job is AdminCustomerBatchMgr.deleteTemporaryDataBatch .
Expired sessions are deleted from the sessions table. These accumulate because most customers tend not to do a formal logout from the application after they've logged in. Another table that tends to grow is the kk_cookie table. Whenever a guest comes to the store, a cookie is created which contains the key to a kk_cookie table record. A temporary customer id is contained within this record and this id is used to insert and fetch shopping cart data so that a customer's cart is persisted even if he is a non-registered customer. The batch job deletes the cookie and cart records if they haven't been read for a programmable number of days. Finally, there is a counter table which is used to get unique ids for temporary customers. The batch job also deletes the data from this table.