Product overview > Cache > Java object caching
Insert data for different time zones
When inserting data with calendar, java.util.Date, and timestamp attributes into an ObjectGrid, ensure these date time attributes are created based on same time zone, especially when deployed into multiple servers in various time zones. Using the same time zone based date time objects can ensure the application is time-zone safe and data can be queried by calendar, java.util.Date and timestamp predicates.
Without explicitly specifying a time zone when creating date time objects, Java™ will use the local time zone and may cause inconsistent date time values in clients and servers.
Consider an example in a distributed deployment in which client1 is in time zone [GMT-0] and client2 is in [GMT-6] and both want to create a java.util.Date object with value '1999-12-31 06:00:00'. Then client1 will create java.util.Date object with value '1999-12-31 06:00:00 [GMT-0]' and client2 will create java.util.Date object with value '1999-12-31 06:00:00 [GMT-6]'. Both java.util.Date objects are not equal because the time zone is different. A similar problem occurs when preloading data into partitions residing in servers in different time zones if local time zone is used to create date time objects.
To avoid the described problem, the application can choose a time zone such as [GMT-0] as the base time zone for creating calendar, java.util.Date, and timestamp objects.
For more information, see Query data in multiple time zones.
Parent topic:Java object caching concepts
Class loader and classpath considerations
Cache key considerations