Skip to main content
added 1 character in body
Source Link

In this case i would store the hashmap of the codes and expressions on the server in cache, where you are already using them for other validation. I would add a cache expiration to that web call and then in the client side just use the server hashmap result in a for loop for the quick client validation. I would possibly return the whole set and store them for some x amount of time on the client as well. This way the checks stay in sync automatically and changes only need to be made in one place.

  • store the hashmap of the codes and expressions on the server in cache, where you are already using them for other validation.

  • add a cache expiration to that web call and then in the client side just use the server hashmap result in a for loop for the quick client validation.

  • return the whole hashmap set and store them for some x amount of time on the client. This way the checks stay in sync automatically and changes only need to be made in one place.

If things start growing or getting more complex in the rules around the codes and expressions that would be a candidate at that point to move to a db of some sorts

In this case i would store the hashmap of the codes and expressions on the server in cache, where you are already using them for other validation. I would add a cache expiration to that web call and then in the client side just use the server hashmap result in a for loop for the quick client validation. I would possibly return the whole set and store them for some x amount of time on the client as well. This way the checks stay in sync automatically and changes only need to be made in one place. If things start growing or getting more complex in the rules around the codes and expressions would be a candidate at that point to move to a db of some sorts

In this case i would

  • store the hashmap of the codes and expressions on the server in cache, where you are already using them for other validation.

  • add a cache expiration to that web call and then in the client side just use the server hashmap result in a for loop for the quick client validation.

  • return the whole hashmap set and store them for some x amount of time on the client. This way the checks stay in sync automatically and changes only need to be made in one place.

If things start growing or getting more complex in the rules around the codes and expressions that would be a candidate at that point to move to a db of some sorts

Source Link

In this case i would store the hashmap of the codes and expressions on the server in cache, where you are already using them for other validation. I would add a cache expiration to that web call and then in the client side just use the server hashmap result in a for loop for the quick client validation. I would possibly return the whole set and store them for some x amount of time on the client as well. This way the checks stay in sync automatically and changes only need to be made in one place. If things start growing or getting more complex in the rules around the codes and expressions would be a candidate at that point to move to a db of some sorts