Enable Dark Mode!
how-to-store-values-in-pos-cache-in-odoo-17.jpg
By: Rahna Rasheed

How to Store Values in POS Cache in Odoo 17

Technical Odoo 17

The caching strategy used by Odoo 17 POS (Point of Sale) keeps frequently used data in memory, which can significantly improve system performance. Some significant benefits of storing values in the Odoo 17 POS cache include the following:

1. Quicker access to data: Cache-based data can be quickly retrieved, negating the need to read it from the database. Faster access times are the outcome, and this can improve the POS system's overall performance and speed.

2. Din database load: By preserving frequently accessed data in the cache, din database load is decreased. This will improve the scalability of the POS system and prevent performance issues brought on by accessing multiple users at once.

3. Improved user experience: You can enhance the user experience with a POS system that responds more quickly and with faster data availability. Quicker transaction completion can improve sales for the customer and raise customer satisfaction.

By storing values in the cache, Odoo 17 POS can benefit substantially overall in terms of performance, scalability, and user experience. By storing data in the cache, the POS system can make better use of the system resources. Additionally, this lessens the amount of hardware needed to run the system.

The 'pos' object in Odoo 17 can be used to store values in the Point of Sale (POS) cache. The 'pos' object offers several methods for cache management. Here are some illustrations of how to use the 'pos' object to store values in the pos cache.

1. To store a value in the POS cache:

this.pos = usePos();
this.pos.get_order().order_note = 'Value';

2. We can retrieve the stored value from POS Cache using:

var note = this.pos.get_order().order_note;

3. We can store values for cashier using:

this.pos.get_cashier().key_name = 'Key value';

4. We can retrieve the stored value from the cashier:

var value = this.pos.get_cashier().Key_name;

5. To store value using the ‘cache’ object:

First we need to import cache.

import { Cache } from "@web/core/utils/cache";

Now initialize cache object.

setup() {
   super.setup();
   this.pos.cache = new Cache();
}
setCacheValue(key, value) {
     this.pos.cache.put(key, value);
}

6. To retrieve value using the ‘cache’ object:

getCacheValue(key) {
     return this.pos.cache.get(key);
}

The temporary data stored in the POS cache will be removed when the POS session ends.

To read more about How to Store Values in PoS Cache in Odoo 16?, refer to our blog How to Store Values in PoS Cache in Odoo 16?


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message